url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/ipv6-support.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="ipv6-support">
</a>
7.1.13 IPv6 Support
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="ipv6-system-support.html">
7.1.13.1 Verifying System Support for IPv6
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ipv6-server-config.html">
7.1.13.2 Configuring the MySQL Server to Permit IPv6 Connections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ipv6-local-connections.html">
7.1.13.3 Connecting Using the IPv6 Local Host Address
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ipv6-remote-connections.html">
7.1.13.4 Connecting Using IPv6 Nonlocal Host Addresses
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ipv6-brokers.html">
7.1.13.5 Obtaining an IPv6 Address from a Broker
</a>
</span>
</dt>
</dl>
</div>
<p>
Support for IPv6 in MySQL includes these capabilities:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL Server can accept TCP/IP connections from clients
connecting over IPv6. For example, this command connects over
IPv6 to the MySQL server on the local host:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa12589945"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-h</span> <span class="token punctuation">:</span><span class="token punctuation">:</span>1</code></pre>
</div>
<p>
To use this capability, two things must be true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Your system must be configured to support IPv6. See
<a class="xref" href="ipv6-system-support.html" title="7.1.13.1 Verifying System Support for IPv6">
Section 7.1.13.1, “Verifying System Support for IPv6”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The default MySQL server configuration permits IPv6
connections in addition to IPv4 connections. To change the
default configuration, start the server with the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system
variable set to an appropriate value. See
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
MySQL account names permit IPv6 addresses to enable DBAs to
specify privileges for clients that connect to the server over
IPv6. See
<a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
Section 8.2.4, “Specifying Account Names”
</a>
. IPv6 addresses can
be specified in account names in statements such as
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
,
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
, and
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42384473"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'bill'</span>@<span class="token string">'::1'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'secret'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> mydb<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'bill'</span>@<span class="token string">'::1'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
IPv6 functions enable conversion between string and internal
format IPv6 address formats, and checking whether values
represent valid IPv6 addresses. For example,
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
and
<a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
<code class="literal">
INET6_NTOA()
</code>
</a>
are similar to
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
and
<a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
<code class="literal">
INET_NTOA()
</code>
</a>
, but handle IPv6
addresses in addition to IPv4 addresses. See
<a class="xref" href="miscellaneous-functions.html" title="14.23 Miscellaneous Functions">
Section 14.23, “Miscellaneous Functions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Group Replication group members can use IPv6 addresses for
communications within the group. A group can contain a mix of
members using IPv6 and members using IPv4. See
<a class="xref" href="group-replication-ipv6.html" title="20.5.5 Support For IPv6 And For Mixed IPv6 And IPv4 Groups">
Section 20.5.5, “Support For IPv6 And For Mixed IPv6 And IPv4 Groups”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The following sections describe how to set up MySQL so that
clients can connect to the server over IPv6.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-tables-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-tables-table">
</a>
28.3.38 The INFORMATION_SCHEMA TABLES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045078469936">
</a>
<p>
The
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
table provides information
about tables in databases.
</p>
<p>
Columns in
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
that represent
table statistics hold cached values. The
<a class="link" href="server-system-variables.html#sysvar_information_schema_stats_expiry">
<code class="literal">
information_schema_stats_expiry
</code>
</a>
system variable defines the period of time before cached table
statistics expire. The default is 86400 seconds (24 hours). If
there are no cached statistics or statistics have expired,
statistics are retrieved from storage engines when querying table
statistics columns. To update cached values at any time for a
given table, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
. To
always retrieve the latest statistics directly from storage
engines, set
<a class="link" href="server-system-variables.html#sysvar_information_schema_stats_expiry">
<code class="literal">
information_schema_stats_expiry
</code>
</a>
to
<code class="literal">
0
</code>
. For more information, see
<a class="xref" href="information-schema-optimization.html" title="10.2.3 Optimizing INFORMATION_SCHEMA Queries">
Section 10.2.3, “Optimizing INFORMATION_SCHEMA Queries”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
system
variable is enabled,
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
may fail because it cannot update statistics
tables in the data dictionary, which use
<code class="literal">
InnoDB
</code>
. For
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
operations that update the key distribution,
failure may occur even if the operation updates the table itself
(for example, if it is a
<code class="literal">
MyISAM
</code>
table). To
obtain the updated distribution statistics, set
<a class="link" href="server-system-variables.html#sysvar_information_schema_stats_expiry">
<code class="literal">
information_schema_stats_expiry=0
</code>
</a>
.
</p>
</div>
<p>
The
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
TABLE_CATALOG
</code>
</p>
<p>
The name of the catalog to which the table belongs. This value
is always
<code class="literal">
def
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_SCHEMA
</code>
</p>
<p>
The name of the schema (database) to which the table belongs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_NAME
</code>
</p>
<p>
The name of the table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_TYPE
</code>
</p>
<p>
<code class="literal">
BASE TABLE
</code>
for a table,
<code class="literal">
VIEW
</code>
for a view, or
<code class="literal">
SYSTEM
VIEW
</code>
for an
<code class="literal">
INFORMATION_SCHEMA
</code>
table.
</p>
<p>
The
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
table does not list
<code class="literal">
TEMPORARY
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENGINE
</code>
</p>
<p>
The storage engine for the table. See
<a class="xref" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
Chapter 17,
<i>
The InnoDB Storage Engine
</i>
</a>
, and
<a class="xref" href="storage-engines.html" title="Chapter 18 Alternative Storage Engines">
Chapter 18,
<i>
Alternative Storage Engines
</i>
</a>
.
</p>
<p>
For partitioned tables,
<code class="literal">
ENGINE
</code>
shows the
name of the storage engine used by all partitions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VERSION
</code>
</p>
<p>
This column is unused. With the removal of
<code class="filename">
.frm
</code>
files in MySQL 8.0, this column now
reports a hardcoded value of
<code class="literal">
10
</code>
, which is
the last
<code class="filename">
.frm
</code>
file version used in MySQL
5.7.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROW_FORMAT
</code>
</p>
<p>
The row-storage format (
<code class="literal">
Fixed
</code>
,
<code class="literal">
Dynamic
</code>
,
<code class="literal">
Compressed
</code>
,
<code class="literal">
Redundant
</code>
,
<code class="literal">
Compact
</code>
). For
<code class="literal">
MyISAM
</code>
tables,
<code class="literal">
Dynamic
</code>
corresponds to what
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -dvv
</strong>
</span>
</a>
reports
as
<code class="literal">
Packed
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_ROWS
</code>
</p>
<p>
The number of rows. Some storage engines, such as
<code class="literal">
MyISAM
</code>
, store the exact count. For other
storage engines, such as
<code class="literal">
InnoDB
</code>
, this value
is an approximation, and may vary from the actual value by as
much as 40% to 50%. In such cases, use
<code class="literal">
SELECT
COUNT(*)
</code>
to obtain an accurate count.
</p>
<p>
<code class="literal">
TABLE_ROWS
</code>
is
<code class="literal">
NULL
</code>
for
<code class="literal">
INFORMATION_SCHEMA
</code>
tables.
</p>
<p>
For
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables, the row count
is only a rough estimate used in SQL optimization. (This is
also true if the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
table is
partitioned.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AVG_ROW_LENGTH
</code>
</p>
<p>
The average row length.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA_LENGTH
</code>
</p>
<p>
For
<code class="literal">
MyISAM
</code>
,
<code class="literal">
DATA_LENGTH
</code>
is the length of the data file, in bytes.
</p>
<p>
For
<code class="literal">
InnoDB
</code>
,
<code class="literal">
DATA_LENGTH
</code>
is the approximate amount of space allocated for the clustered
index, in bytes. Specifically, it is the clustered index size,
in pages, multiplied by the
<code class="literal">
InnoDB
</code>
page
size.
</p>
<p>
Refer to the notes at the end of this section for information
regarding other storage engines.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MAX_DATA_LENGTH
</code>
</p>
<p>
For
<code class="literal">
MyISAM
</code>
,
<code class="literal">
MAX_DATA_LENGTH
</code>
is maximum length of the
data file. This is the total number of bytes of data that can
be stored in the table, given the data pointer size used.
</p>
<p>
Unused for
<code class="literal">
InnoDB
</code>
.
</p>
<p>
Refer to the notes at the end of this section for information
regarding other storage engines.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INDEX_LENGTH
</code>
</p>
<p>
For
<code class="literal">
MyISAM
</code>
,
<code class="literal">
INDEX_LENGTH
</code>
is the length of the index file, in bytes.
</p>
<p>
For
<code class="literal">
InnoDB
</code>
,
<code class="literal">
INDEX_LENGTH
</code>
is the approximate amount of space allocated for non-clustered
indexes, in bytes. Specifically, it is the sum of
non-clustered index sizes, in pages, multiplied by the
<code class="literal">
InnoDB
</code>
page size.
</p>
<p>
Refer to the notes at the end of this section for information
regarding other storage engines.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA_FREE
</code>
</p>
<p>
The number of allocated but unused bytes.
</p>
<p>
<code class="literal">
InnoDB
</code>
tables report the free space of the
tablespace to which the table belongs. For a table located in
the shared tablespace, this is the free space of the shared
tablespace. If you are using multiple tablespaces and the
table has its own tablespace, the free space is for only that
table. Free space means the number of bytes in completely free
extents minus a safety margin. Even if free space displays as
0, it may be possible to insert rows as long as new extents
need not be allocated.
</p>
<p>
For NDB Cluster,
<code class="literal">
DATA_FREE
</code>
shows the space
allocated on disk for, but not used by, a Disk Data table or
fragment on disk. (In-memory data resource usage is reported
by the
<code class="literal">
DATA_LENGTH
</code>
column.)
</p>
<p>
For partitioned tables, this value is only an estimate and may
not be absolutely correct. A more accurate method of obtaining
this information in such cases is to query the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
<code class="literal">
PARTITIONS
</code>
</a>
table, as shown in
this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77298905"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">SUM</span><span class="token punctuation">(</span>DATA_FREE<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PARTITIONS</span>
<span class="token keyword">WHERE</span> TABLE_SCHEMA <span class="token operator">=</span> <span class="token string">'mydb'</span>
<span class="token operator">AND</span> <span class="token keyword">TABLE_NAME</span> <span class="token operator">=</span> <span class="token string">'mytable'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
Section 28.3.21, “The INFORMATION_SCHEMA PARTITIONS Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AUTO_INCREMENT
</code>
</p>
<p>
The next
<code class="literal">
AUTO_INCREMENT
</code>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CREATE_TIME
</code>
</p>
<p>
When the table was created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UPDATE_TIME
</code>
</p>
<p>
When the table was last updated. For some storage engines,
this value is
<code class="literal">
NULL
</code>
. Even with
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
mode
with each
<code class="literal">
InnoDB
</code>
table in a separate
<code class="literal">
.ibd
</code>
file,
<a class="link" href="glossary.html#glos_change_buffering" title="change buffering">
change buffering
</a>
can delay the write to the data file, so the file modification
time is different from the time of the last insert, update, or
delete. For
<code class="literal">
MyISAM
</code>
, the data file timestamp
is used; however, on Windows the timestamp is not updated by
updates, so the value is inaccurate.
</p>
<p>
<code class="literal">
UPDATE_TIME
</code>
displays a timestamp value for
the last
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
,
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
, or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
performed on
<code class="literal">
InnoDB
</code>
tables that are not partitioned. For
MVCC, the timestamp value reflects the
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
time, which is
considered the last update time. Timestamps are not persisted
when the server is restarted or when the table is evicted from
the
<code class="literal">
InnoDB
</code>
data dictionary cache.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHECK_TIME
</code>
</p>
<p>
When the table was last checked. Not all storage engines
update this time, in which case, the value is always
<code class="literal">
NULL
</code>
.
</p>
<p>
For partitioned
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables,
<code class="literal">
CHECK_TIME
</code>
is always
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_COLLATION
</code>
</p>
<p>
The table default collation. The output does not explicitly
list the table default character set, but the collation name
begins with the character set name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHECKSUM
</code>
</p>
<p>
The live checksum value, if any.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CREATE_OPTIONS
</code>
</p>
<p>
Extra options used with
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
.
</p>
<p>
<code class="literal">
CREATE_OPTIONS
</code>
shows
<code class="literal">
partitioned
</code>
for a partitioned table.
</p>
<p>
<code class="literal">
CREATE_OPTIONS
</code>
shows the
<code class="literal">
ENCRYPTION
</code>
clause specified for tables
created in file-per-table tablespaces. It shows the encryption
clause for file-per-table tablespaces if the table is
encrypted or if the specified encryption differs from the
schema encryption. The encryption clause is not shown for
tables created in general tablespaces. To identify encrypted
file-per-table and general tablespaces, query the
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
<code class="literal">
ENCRYPTION
</code>
column.
</p>
<p>
When creating a table with
<a class="link" href="glossary.html#glos_strict_mode" title="strict mode">
strict mode
</a>
disabled,
the storage engine's default row format is used if the
specified row format is not supported. The actual row format
of the table is reported in the
<code class="literal">
ROW_FORMAT
</code>
column.
<code class="literal">
CREATE_OPTIONS
</code>
shows the row format
that was specified in the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statement.
</p>
<p>
When altering the storage engine of a table, table options
that are not applicable to the new storage engine are retained
in the table definition to enable reverting the table with its
previously defined options to the original storage engine, if
necessary. The
<code class="literal">
CREATE_OPTIONS
</code>
column may
show retained options.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_COMMENT
</code>
</p>
<p>
The comment used when creating the table (or information as to
why MySQL could not access the table information).
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045078331600">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, the output of
this statement shows appropriate values for the
<code class="literal">
AVG_ROW_LENGTH
</code>
and
<code class="literal">
DATA_LENGTH
</code>
columns, with the exception
that
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
columns are not taken
into account.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables,
<code class="literal">
DATA_LENGTH
</code>
includes data stored in main
memory only; the
<code class="literal">
MAX_DATA_LENGTH
</code>
and
<code class="literal">
DATA_FREE
</code>
columns apply to Disk Data.
</p>
</li>
<li class="listitem">
<p>
For NDB Cluster Disk Data tables,
<code class="literal">
MAX_DATA_LENGTH
</code>
shows the space allocated
for the disk part of a Disk Data table or fragment. (In-memory
data resource usage is reported by the
<code class="literal">
DATA_LENGTH
</code>
column.)
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
MEMORY
</code>
tables, the
<code class="literal">
DATA_LENGTH
</code>
,
<code class="literal">
MAX_DATA_LENGTH
</code>
, and
<code class="literal">
INDEX_LENGTH
</code>
values approximate the actual
amount of allocated memory. The allocation algorithm reserves
memory in large amounts to reduce the number of allocation
operations.
</p>
</li>
<li class="listitem">
<p>
For views, most
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
columns
are 0 or
<code class="literal">
NULL
</code>
except that
<code class="literal">
TABLE_NAME
</code>
indicates the view name,
<code class="literal">
CREATE_TIME
</code>
indicates the creation time,
and
<code class="literal">
TABLE_COMMENT
</code>
says
<code class="literal">
VIEW
</code>
.
</p>
</li>
</ul>
</div>
<p>
Table information is also available from the
<a class="link" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
<code class="literal">
SHOW TABLE STATUS
</code>
</a>
and
<a class="link" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
<code class="literal">
SHOW TABLES
</code>
</a>
statements. See
<a class="xref" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
Section 15.7.7.38, “SHOW TABLE STATUS Statement”
</a>
, and
<a class="xref" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
Section 15.7.7.39, “SHOW TABLES Statement”
</a>
. The following statements are
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26401876"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
<span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> <span class="token keyword">ENGINE</span><span class="token punctuation">,</span> VERSION<span class="token punctuation">,</span> <span class="token keyword">ROW_FORMAT</span><span class="token punctuation">,</span> TABLE_ROWS<span class="token punctuation">,</span> <span class="token keyword">AVG_ROW_LENGTH</span><span class="token punctuation">,</span>
DATA_LENGTH<span class="token punctuation">,</span> MAX_DATA_LENGTH<span class="token punctuation">,</span> INDEX_LENGTH<span class="token punctuation">,</span> DATA_FREE<span class="token punctuation">,</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
CREATE_TIME<span class="token punctuation">,</span> UPDATE_TIME<span class="token punctuation">,</span> CHECK_TIME<span class="token punctuation">,</span> TABLE_COLLATION<span class="token punctuation">,</span> <span class="token keyword">CHECKSUM</span><span class="token punctuation">,</span>
CREATE_OPTIONS<span class="token punctuation">,</span> TABLE_COMMENT
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span>
<span class="token keyword">WHERE</span> table_schema <span class="token operator">=</span> <span class="token string">'<em class="replaceable">db_name</em>'</span>
<span class="token punctuation">[</span><span class="token operator">AND</span> <span class="token keyword">table_name</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">SHOW</span> <span class="token keyword">TABLE</span> <span class="token keyword">STATUS</span>
<span class="token keyword">FROM</span> <em class="replaceable">db_name</em>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
The following statements are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63784876"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
<span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> TABLE_TYPE
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span>
<span class="token keyword">WHERE</span> table_schema <span class="token operator">=</span> <span class="token string">'<em class="replaceable">db_name</em>'</span>
<span class="token punctuation">[</span><span class="token operator">AND</span> <span class="token keyword">table_name</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">SHOW</span> <span class="token keyword">FULL</span> <span class="token keyword">TABLES</span>
<span class="token keyword">FROM</span> <em class="replaceable">db_name</em>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-debian.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-debian">
</a>
25.3.1.3 Installing NDB Cluster Using .deb Files
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045122682944">
</a>
<a class="indexterm" name="idm46045122681456">
</a>
<a class="indexterm" name="idm46045122679968">
</a>
<p>
The section provides information about installing NDB Cluster on
Debian and related Linux distributions such Ubuntu using the
<code class="filename">
.deb
</code>
files supplied by Oracle for this
purpose.
</p>
<p>
Oracle also provides an NDB Cluster APT repository for Debian
and other distributions. See
<a class="ulink" href="/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-cluster-install" target="_top">
<em class="citetitle">
Installing
MySQL NDB Cluster Using the APT Repository
</em>
</a>
,
for instructions and additional information.
</p>
<p>
Oracle provides
<code class="filename">
.deb
</code>
installer files for
NDB Cluster for 32-bit and 64-bit platforms. For a Debian-based
system, only a single installer file is necessary. This file is
named using the pattern shown here, according to the applicable
NDB Cluster version, Debian version, and architecture:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa42724233"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">mysql<span class="token operator">-</span>cluster<span class="token operator">-</span>gpl<span class="token operator">-</span><em class="replaceable">ndbver</em><span class="token operator">-</span>debian<em class="replaceable">debianver</em><span class="token operator">-</span><em class="replaceable">arch</em><span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
Here,
<em class="replaceable">
<code>
ndbver
</code>
</em>
is the 3-part
<code class="literal">
NDB
</code>
engine version number,
<em class="replaceable">
<code>
debianver
</code>
</em>
is the major version of
Debian (
<code class="literal">
8
</code>
or
<code class="literal">
9
</code>
), and
<em class="replaceable">
<code>
arch
</code>
</em>
is one of
<code class="literal">
i686
</code>
or
<code class="literal">
x86_64
</code>
. In the
examples that follow, we assume you wish to install NDB
8.4.0 on a 64-bit Debian 9 system; in this
case, the installer file is named
<code class="filename">
mysql-cluster-gpl-8.4.0-debian9-x86_64.deb-bundle.tar
</code>
.
</p>
<p>
Once you have downloaded the appropriate
<code class="filename">
.deb
</code>
file, you can untar it, and then
install it from the command line using
<code class="literal">
dpkg
</code>
,
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa68872878"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">dpkg</span> <span class="token property">-i</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-debian9-i686<span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
You can also remove it using
<code class="literal">
dpkg
</code>
as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa17676115"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">dpkg</span> <span class="token property">-r</span> mysql</code></pre>
</div>
<p>
The installer file should also be compatible with most graphical
package managers that work with
<code class="filename">
.deb
</code>
files,
such as
<code class="literal">
GDebi
</code>
for the Gnome desktop.
</p>
<p>
The
<code class="filename">
.deb
</code>
file installs NDB Cluster under
<code class="filename">
/opt/mysql/server-
<em class="replaceable">
<code>
version
</code>
</em>
/
</code>
,
where
<em class="replaceable">
<code>
version
</code>
</em>
is the 2-part release
series version for the included MySQL server. For NDB
8.4, this is always
<code class="literal">
8.4
</code>
. The directory layout is the
same as that for the generic Linux binary distribution (see
<a class="xref" href="binary-installation.html#binary-installation-layout" title="Table 2.3 MySQL Installation Layout for Generic Unix/Linux Binary Package">
Table 2.3, “MySQL Installation Layout for Generic Unix/Linux Binary Package”
</a>
), with the
exception that startup scripts and configuration files are found
in
<code class="filename">
support-files
</code>
instead of
<code class="filename">
share
</code>
. All NDB Cluster executables, such as
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
,
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd
</strong>
</span>
</a>
, and
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
, are placed in the
<code class="filename">
bin
</code>
directory.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-purge-configuration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-purge-configuration">
</a>
17.8.9 Purge Configuration
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162570640">
</a>
<a class="indexterm" name="idm46045162569568">
</a>
<a class="indexterm" name="idm46045162568496">
</a>
<p>
<code class="literal">
InnoDB
</code>
does not physically remove a row from
the database immediately when you delete it with an SQL statement.
A row and its index records are only physically removed when
<code class="literal">
InnoDB
</code>
discards the undo log record written for
the deletion. This removal operation, which only occurs after the
row is no longer required for multi-version concurrency control
(MVCC) or rollback, is called a purge.
</p>
<p>
Purge runs on a periodic schedule. It parses and processes undo
log pages from the history list, which is a list of undo log pages
for committed transactions that is maintained by the
<code class="literal">
InnoDB
</code>
transaction system. Purge frees the undo
log pages from the history list after processing them.
</p>
<h4>
<a name="idm46045162563776">
</a>
Configuring Purge Threads
</h4>
<p>
Purge operations are performed in the background by one or more
purge threads. The number of purge threads is controlled by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
variable.
The default value is 1 if the number of available logical
processors is <= 16, otherwise the default is 4.
</p>
<p>
If DML action is concentrated on a single table, purge operations
for the table are performed by a single purge thread, which can
result in slowed purge operations, increased purge lag, and
increased tablespace file size if the DML operations involve large
object values. If the
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
setting is
exceeded, purge work is automatically redistributed among
available purge threads. Too many active purge threads in this
scenario can cause contention with user threads, so manage the
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
setting
accordingly. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
variable is
set to 0 by default, which means that there is no maximum purge
lag by default.
</p>
<p>
If DML action is concentrated on few tables, keep the
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
setting low
so that the threads do not contend with each other for access to
the busy tables. If DML operations are spread across many tables,
consider a higher
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
setting. The
maximum number of purge threads is 32.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
setting
is the maximum number of purge threads permitted. The purge system
automatically adjusts the number of purge threads that are used.
</p>
<h4>
<a name="idm46045162551200">
</a>
Configuring Purge Batch Size
</h4>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_batch_size">
<code class="literal">
innodb_purge_batch_size
</code>
</a>
variable defines the number of undo log pages that purge parses
and processes in one batch from the history list. The default
value is 300. In a multithreaded purge configuration, the
coordinator purge thread divides
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_batch_size">
<code class="literal">
innodb_purge_batch_size
</code>
</a>
by
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
and assigns
that number of pages to each purge thread.
</p>
<p>
The purge system also frees the undo log pages that are no longer
required. It does so every 128 iterations through the undo logs.
In addition to defining the number of undo log pages parsed and
processed in a batch, the
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_batch_size">
<code class="literal">
innodb_purge_batch_size
</code>
</a>
variable
defines the number of undo log pages that purge frees every 128
iterations through the undo logs.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_batch_size">
<code class="literal">
innodb_purge_batch_size
</code>
</a>
variable is intended for advanced performance tuning and
experimentation. Most users need not change
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_batch_size">
<code class="literal">
innodb_purge_batch_size
</code>
</a>
from its
default value.
</p>
<h4>
<a name="idm46045162540928">
</a>
Configuring the Maximum Purge Lag
</h4>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
variable
defines the desired maximum purge lag. When the purge lag exceeds
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
threshold, a delay is imposed on
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations to allow time for
purge operations to catch up. The default value is 0, which means
there is no maximum purge lag and no delay.
</p>
<p>
The
<code class="literal">
InnoDB
</code>
transaction system maintains a list
of transactions that have index records delete-marked by
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations. The length of
the list is the purge lag.
</p>
<p>
The purge lag delay is calculated by the following formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa96685147"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">(purge_lag/innodb_max_purge_lag - 0.9995) * 10000</code></pre>
</div>
<p>
The delay is calculated at the beginning of a purge batch.
</p>
<p>
A typical
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
setting for a problematic workload might be 1000000 (1 million),
assuming that transactions are small, only 100 bytes in size, and
it is permissible to have 100MB of unpurged table rows.
</p>
<p>
The purge lag is presented as the
<code class="literal">
History list
length
</code>
value in the
<code class="literal">
TRANSACTIONS
</code>
section of
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW
ENGINE INNODB STATUS
</code>
</a>
output.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa10004520"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql></span><span class="token command"> SHOW</span> ENGINE INNODB STATUS<span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token property">------------</span>
TRANSACTIONS
<span class="token property">------------</span>
Trx id counter 0 290328385
Purge done for trx's n<span class="token punctuation">:</span>o < 0 290315608 undo n<span class="token punctuation">:</span>o < 0 17
History list length 20</code></pre>
</div>
<p>
The
<code class="literal">
History list length
</code>
is typically a low
value, usually less than a few thousand, but a write-heavy
workload or long running transactions can cause it to increase,
even for transactions that are read only. The reason that a long
running transaction can cause the
<code class="literal">
History list
length
</code>
to increase is that under a consistent read
transaction isolation level such as
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
, a transaction
must return the same result as when the read view for that
transaction was created. Consequently, the
<code class="literal">
InnoDB
</code>
multi-version concurrency control (MVCC)
system must keep a copy of the data in the undo log until all
transactions that depend on that data have completed. The
following are examples of long running transactions that could
cause the
<code class="literal">
History list length
</code>
to increase:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
operation that uses the
<a class="link" href="mysqldump.html#option_mysqldump_single-transaction">
<code class="option">
--single-transaction
</code>
</a>
option
while there is a significant amount of concurrent DML.
</p>
</li>
<li class="listitem">
<p>
Running a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
query after
disabling
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
, and
forgetting to issue an explicit
<code class="literal">
COMMIT
</code>
or
<code class="literal">
ROLLBACK
</code>
.
</p>
</li>
</ul>
</div>
<p>
To prevent excessive delays in extreme situations where the purge
lag becomes huge, you can limit the delay by setting the
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag_delay">
<code class="literal">
innodb_max_purge_lag_delay
</code>
</a>
variable. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag_delay">
<code class="literal">
innodb_max_purge_lag_delay
</code>
</a>
variable specifies the maximum delay in microseconds for the delay
imposed when the
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
threshold is
exceeded. The specified
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag_delay">
<code class="literal">
innodb_max_purge_lag_delay
</code>
</a>
value
is an upper limit on the delay period calculated by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_max_purge_lag">
<code class="literal">
innodb_max_purge_lag
</code>
</a>
formula.
</p>
<h4>
<a name="idm46045162500736">
</a>
Purge and Undo Tablespace Truncation
</h4>
<p>
The purge system is also responsible for truncating undo
tablespaces. You can configure the
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_rseg_truncate_frequency">
<code class="literal">
innodb_purge_rseg_truncate_frequency
</code>
</a>
variable to control the frequency with which the purge system
looks for undo tablespaces to truncate. For more information, see
<a class="xref" href="innodb-undo-tablespaces.html#truncate-undo-tablespace" title="Truncating Undo Tablespaces">
Truncating Undo Tablespaces
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-python-table-delete.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-shell-tutorial-python-table-delete">
</a>
22.4.4.4 Delete Tables
</h4>
</div>
</div>
</div>
<p>
You can use the
<code class="literal">
delete()
</code>
method to remove
some or all records from a table in a database. The X DevAPI
provides additional methods to use with the
<code class="literal">
delete()
</code>
method to filter and order the
records to be deleted.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-delete-records-using-conditions">
</a>
Delete Records Using Conditions
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045126769360">
</a>
<p>
The example that follows passes search conditions to the
<code class="literal">
delete()
</code>
method. All records matching the
condition are deleted from the
<code class="literal">
city
</code>
table.
In this example, one record matches the condition.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa43379249"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>city<span class="token punctuation">.</span><span class="token keyword">delete</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">where</span><span class="token punctuation">(</span><span class="token string">"Name = 'Olympia'"</span><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-delete-first-record">
</a>
Delete the First Record
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045126762768">
</a>
<p>
To delete the first record in the city table, use the
<code class="literal">
limit()
</code>
method with a value of 1.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa97200748"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>city<span class="token punctuation">.</span><span class="token keyword">delete</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">limit</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-delete-all-records">
</a>
Delete All Records in a Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045126757088">
</a>
<p>
You can delete all records in a table. To do so, use the
<code class="literal">
delete()
</code>
method without specifying a search
condition.
</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Caution
</div>
<p>
Use care when you delete records without specifying a search
condition; doing so deletes all records from the table.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-drop-table">
</a>
Drop a Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045126752240">
</a>
<p>
The
<code class="literal">
drop_collection()
</code>
method is also used
in MySQL Shell to drop a relational table from a database.
For example, to drop the
<code class="literal">
citytest
</code>
table
from the
<code class="literal">
world_x
</code>
database, issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa80011897"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span><span class="token function">drop_collection</span><span class="token punctuation">(</span><span class="token string">"citytest"</span><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045126746272">
</a>
Related Information
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/crud-ebnf-table-crud-functions.html#crud-ebnf-tabledeletefunction" target="_top">
TableDeleteFunction
</a>
for
the full syntax definition.
</p>
</li>
<li class="listitem">
<p>
See
<a class="xref" href="mysql-shell-tutorial-python-download.html" title="22.4.2 Download and Import world_x Database">
Section 22.4.2, “Download and Import world_x Database”
</a>
for instructions to recreate the
<code class="literal">
world_x
</code>
database.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-security-networking-issues.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-security-networking-issues">
</a>
25.6.21.1 NDB Cluster Security and Networking Issues
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045087112944">
</a>
<p>
In this section, we discuss basic network security issues as
they relate to NDB Cluster. It is extremely important to
remember that NDB Cluster
<span class="quote">
“
<span class="quote">
out of the box
</span>
”
</span>
is not
secure; you or your network administrator must take the proper
steps to ensure that your cluster cannot be compromised over the
network.
</p>
<a class="indexterm" name="idm46045087109856">
</a>
<p>
Cluster communication protocols are inherently insecure, and no
encryption or similar security measures are used in
communications between nodes in the cluster. Because network
speed and latency have a direct impact on the cluster's
efficiency, it is also not advisable to employ SSL or other
encryption to network connections between nodes, as such schemes
cause slow communications.
</p>
<p>
It is also true that no authentication is used for controlling
API node access to an NDB Cluster. As with encryption, the
overhead of imposing authentication requirements would have an
adverse impact on Cluster performance.
</p>
<p>
In addition, there is no checking of the source IP address for
either of the following when accessing the cluster:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL or API nodes using
<span class="quote">
“
<span class="quote">
free slots
</span>
”
</span>
created by
empty
<code class="literal">
[mysqld]
</code>
or
<code class="literal">
[api]
</code>
sections in the
<code class="filename">
config.ini
</code>
file
</p>
<p>
This means that, if there are any empty
<code class="literal">
[mysqld]
</code>
or
<code class="literal">
[api]
</code>
sections in the
<code class="filename">
config.ini
</code>
file, then
any API nodes (including SQL nodes) that know the management
server's host name (or IP address) and port can connect
to the cluster and access its data without restriction. (See
<a class="xref" href="mysql-cluster-security-mysql-privileges.html" title="25.6.21.2 NDB Cluster and MySQL Privileges">
Section 25.6.21.2, “NDB Cluster and MySQL Privileges”
</a>
,
for more information about this and related issues.)
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="indexterm" name="idm46045087098528">
</a>
<a class="indexterm" name="idm46045087096624">
</a>
<a class="indexterm" name="idm46045087094720">
</a>
You can exercise some control over SQL and API node access
to the cluster by specifying a
<code class="literal">
HostName
</code>
parameter for all
<code class="literal">
[mysqld]
</code>
and
<code class="literal">
[api]
</code>
sections in the
<code class="filename">
config.ini
</code>
file. However, this also
means that, should you wish to connect an API node to the
cluster from a previously unused host, you need to add an
<code class="literal">
[api]
</code>
section containing its host name
to the
<code class="filename">
config.ini
</code>
file.
</p>
<p>
More information is available
<a class="link" href="mysql-cluster-api-definition.html#ndbparam-api-hostname">
elsewhere in this
chapter
</a>
about the
<code class="literal">
HostName
</code>
parameter. Also see
<a class="xref" href="mysql-cluster-quick.html" title="25.4.1 Quick Test Setup of NDB Cluster">
Section 25.4.1, “Quick Test Setup of NDB Cluster”
</a>
,
for configuration examples using
<code class="literal">
HostName
</code>
with API nodes.
</p>
</div>
</li>
<li class="listitem">
<p>
Any
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
client
</p>
<p>
This means that any cluster management client that is given
the management server's host name (or IP address) and
port (if not the standard port) can connect to the cluster
and execute any management client command. This includes
commands such as
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-stop">
<code class="literal">
ALL
STOP
</code>
</a>
and
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-shutdown">
<code class="literal">
SHUTDOWN
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
<a class="indexterm" name="idm46045087079488">
</a>
<a class="indexterm" name="idm46045087077568">
</a>
For these reasons, it is necessary to protect the cluster on the
network level. The safest network configuration for Cluster is
one which isolates connections between Cluster nodes from any
other network communications. This can be accomplished by any of
the following methods:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Keeping Cluster nodes on a network that is physically
separate from any public networks. This option is the most
dependable; however, it is the most expensive to implement.
</p>
<p>
We show an example of an NDB Cluster setup using such a
physically segregated network here:
</p>
<div class="figure">
<a name="fig-mysql-cluster-hardware-firewall">
</a>
<p class="title">
<b>
Figure 25.7 NDB Cluster with Hardware Firewall
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Content is described in the surrounding text." src="images/cluster-security-network-1.png" style="width: 100%; max-width: 700px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
This setup has two networks, one private (solid box) for the
Cluster management servers and data nodes, and one public
(dotted box) where the SQL nodes reside. (We show the
management and data nodes connected using a gigabit switch
since this provides the best performance.) Both networks are
protected from the outside by a hardware firewall, sometimes
also known as a
<span class="firstterm">
network-based
firewall
</span>
.
</p>
<p>
This network setup is safest because no packets can reach
the cluster's management or data nodes from outside the
network—and none of the cluster's internal
communications can reach the outside—without going
through the SQL nodes, as long as the SQL nodes do not
permit any packets to be forwarded. This means, of course,
that all SQL nodes must be secured against hacking attempts.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
With regard to potential security vulnerabilities, an SQL
node is no different from any other MySQL server. See
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
, for a
description of techniques you can use to secure MySQL
servers.
</p>
</div>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045087060768">
</a>
<a class="indexterm" name="idm46045087058896">
</a>
Using one or more software firewalls (also known as
<span class="firstterm">
host-based firewalls
</span>
)
to control which packets pass through to the cluster from
portions of the network that do not require access to it. In
this type of setup, a software firewall must be installed on
every host in the cluster which might otherwise be
accessible from outside the local network.
</p>
<p>
The host-based option is the least expensive to implement,
but relies purely on software to provide protection and so
is the most difficult to keep secure.
</p>
<p>
This type of network setup for NDB Cluster is illustrated
here:
</p>
<div class="figure">
<a name="fig-mysql-cluster-software-firewalls">
</a>
<p class="title">
<b>
Figure 25.8 NDB Cluster with Software Firewalls
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Content is described in the surrounding text." src="images/cluster-security-network-2.png" style="width: 100%; max-width: 500px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
Using this type of network setup means that there are two
zones of NDB Cluster hosts. Each cluster host must be able
to communicate with all of the other machines in the
cluster, but only those hosting SQL nodes (dotted box) can
be permitted to have any contact with the outside, while
those in the zone containing the data nodes and management
nodes (solid box) must be isolated from any machines that
are not part of the cluster. Applications using the cluster
and user of those applications must
<span class="emphasis">
<em>
not
</em>
</span>
be permitted to have direct access to the management and
data node hosts.
</p>
<p>
To accomplish this, you must set up software firewalls that
limit the traffic to the type or types shown in the
following table, according to the type of node that is
running on each cluster host computer:
</p>
<div class="table">
<a name="idm46045087046176">
</a>
<p class="title">
<b>
Table 25.40 Node types in a host-based firewall cluster configuration
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 25%"/>
<col style="width: 75%"/>
</colgroup>
<thead>
<tr>
<th>
Node Type
</th>
<th>
Permitted Traffic
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
SQL or API node
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It originates from the IP address of a
management or data node (using any TCP or UDP
port).
</p>
</li>
<li class="listitem">
<p>
It originates from within the network in which
the cluster resides and is on the port that your
application is using.
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
Data node or Management node
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It originates from the IP address of a
management or data node (using any TCP or UDP
port).
</p>
</li>
<li class="listitem">
<p>
It originates from the IP address of an SQL or
API node.
</p>
</li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Any traffic other than that shown in the table for a given
node type should be denied.
</p>
<p>
The specifics of configuring a firewall vary from firewall
application to firewall application, and are beyond the
scope of this Manual.
<span class="command">
<strong>
iptables
</strong>
</span>
is a very
common and reliable firewall application, which is often
used with
<span class="command">
<strong>
APF
</strong>
</span>
as a front end to make
configuration easier. You can (and should) consult the
documentation for the software firewall that you employ,
should you choose to implement an NDB Cluster network setup
of this type, or of a
<span class="quote">
“
<span class="quote">
mixed
</span>
”
</span>
type as discussed
under the next item.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045087028400">
</a>
<a class="indexterm" name="idm46045087026496">
</a>
It is also possible to employ a combination of the first two
methods, using both hardware and software to secure the
cluster—that is, using both network-based and
host-based firewalls. This is between the first two schemes
in terms of both security level and cost. This type of
network setup keeps the cluster behind the hardware
firewall, but permits incoming packets to travel beyond the
router connecting all cluster hosts to reach the SQL nodes.
</p>
<p>
One possible network deployment of an NDB Cluster using
hardware and software firewalls in combination is shown
here:
</p>
<div class="figure">
<a name="fig-mysql-cluster-combination-firewalls">
</a>
<p class="title">
<b>
Figure 25.9 NDB Cluster with a Combination of Hardware and Software Firewalls
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Content is described in the surrounding text." src="images/cluster-security-network-3.png" style="width: 100%; max-width: 500px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
In this case, you can set the rules in the hardware firewall
to deny any external traffic except to SQL nodes and API
nodes, and then permit traffic to them only on the ports
required by your application.
</p>
</li>
</ol>
</div>
<p>
Whatever network configuration you use, remember that your
objective from the viewpoint of keeping the cluster secure
remains the same—to prevent any unessential traffic from
reaching the cluster while ensuring the most efficient
communication between the nodes in the cluster.
</p>
<p>
<a class="indexterm" name="idm46045087014448">
</a>
<a class="indexterm" name="idm46045087012544">
</a>
Because NDB Cluster requires large numbers of ports to be open
for communications between nodes, the recommended option is to
use a segregated network. This represents the simplest way to
prevent unwanted traffic from reaching the cluster.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="indexterm" name="idm46045087010112">
</a>
<a class="indexterm" name="idm46045087008240">
</a>
If you wish to administer an NDB Cluster remotely (that is,
from outside the local network), the recommended way to do
this is to use
<span class="command">
<strong>
ssh
</strong>
</span>
or another secure login
shell to access an SQL node host. From this host, you can then
run the management client to access the management server
safely, from within the cluster's own local network.
</p>
<p>
Even though it is possible to do so in theory, it is
<span class="emphasis">
<em>
not
</em>
</span>
recommended to use
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
to manage a Cluster directly from
outside the local network on which the Cluster is running.
Since neither authentication nor encryption takes place
between the management client and the management server, this
represents an extremely insecure means of managing the
cluster, and is almost certain to be compromised sooner or
later.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-engine.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-engine">
</a>
15.7.7.16 SHOW ENGINE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170704320">
</a>
<a class="indexterm" name="idm46045170703248">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89528081"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> <em class="replaceable">engine_name</em> {<span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">MUTEX</span>}</code></pre>
</div>
<p>
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE
</code>
</a>
displays operational
information about a storage engine. It requires the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege. The statement
has these variants:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17240958"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> INNODB <span class="token keyword">STATUS</span>
<span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> INNODB <span class="token keyword">MUTEX</span>
<span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> PERFORMANCE_SCHEMA <span class="token keyword">STATUS</span></code></pre>
</div>
<p>
<code class="literal">
SHOW ENGINE INNODB STATUS
</code>
displays extensive
information from the standard
<code class="literal">
InnoDB
</code>
Monitor
about the state of the
<code class="literal">
InnoDB
</code>
storage engine.
For information about the standard monitor and other
<code class="literal">
InnoDB
</code>
Monitors that provide information
about
<code class="literal">
InnoDB
</code>
processing, see
<a class="xref" href="innodb-monitors.html" title="17.17 InnoDB Monitors">
Section 17.17, “InnoDB Monitors”
</a>
.
</p>
<p>
<code class="literal">
SHOW ENGINE INNODB MUTEX
</code>
displays
<code class="literal">
InnoDB
</code>
<a class="link" href="glossary.html#glos_mutex" title="mutex">
mutex
</a>
and
<a class="link" href="glossary.html#glos_rw_lock" title="rw-lock">
rw-lock
</a>
statistics.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
mutexes and rwlocks can also be
monitored using
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance
Schema
</a>
tables. See
<a class="xref" href="monitor-innodb-mutex-waits-performance-schema.html" title="17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema">
Section 17.16.2, “Monitoring InnoDB Mutex Waits Using Performance Schema”
</a>
.
</p>
</div>
<p>
Mutex statistics collection is configured dynamically using the
following options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To enable the collection of mutex statistics, run:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa60743563"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_monitor_enable<span class="token operator">=</span><span class="token string">'latch'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To reset mutex statistics, run:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa72948290"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_monitor_reset<span class="token operator">=</span><span class="token string">'latch'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To disable the collection of mutex statistics, run:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa68186147"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_monitor_disable<span class="token operator">=</span><span class="token string">'latch'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Collection of mutex statistics for
<code class="literal">
SHOW ENGINE INNODB
MUTEX
</code>
can also be enabled by setting
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_enable">
<code class="literal">
innodb_monitor_enable='all'
</code>
</a>
, or
disabled by setting
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_disable">
<code class="literal">
innodb_monitor_disable='all'
</code>
</a>
.
</p>
<p>
<code class="literal">
SHOW ENGINE INNODB MUTEX
</code>
output has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Type
</code>
</p>
<p>
Always
<code class="literal">
InnoDB
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Name
</code>
</p>
<p>
For mutexes, the
<code class="literal">
Name
</code>
field reports only
the mutex name. For rwlocks, the
<code class="literal">
Name
</code>
field reports the source file where the rwlock is
implemented, and the line number in the file where the
rwlock is created. The line number is specific to your
version of MySQL.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Status
</code>
</p>
<p>
The mutex status. This field reports the number of spins,
waits, and calls. Statistics for low-level operating system
mutexes, which are implemented outside of
<code class="literal">
InnoDB
</code>
, are not reported.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
spins
</code>
indicates the number of spins.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waits
</code>
indicates the number of mutex
waits.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
calls
</code>
indicates how many times the
mutex was requested.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
<code class="literal">
SHOW ENGINE INNODB MUTEX
</code>
does not list
mutexes and rw-locks for each buffer pool block, as the amount
of output would be overwhelming on systems with a large buffer
pool.
<code class="literal">
SHOW ENGINE INNODB MUTEX
</code>
does, however,
print aggregate
<code class="literal">
BUF_BLOCK_MUTEX
</code>
spin, wait,
and call values for buffer pool block mutexes and rw-locks.
<code class="literal">
SHOW ENGINE INNODB MUTEX
</code>
also does not list
any mutexes or rw-locks that have never been waited on
(
<code class="literal">
os_waits=0
</code>
). Thus,
<code class="literal">
SHOW ENGINE
INNODB MUTEX
</code>
only displays information about mutexes
and rw-locks outside of the buffer pool that have caused at
least one OS-level
<a class="link" href="glossary.html#glos_wait" title="wait">
wait
</a>
.
</p>
<p>
Use
<code class="literal">
SHOW ENGINE PERFORMANCE_SCHEMA STATUS
</code>
to
inspect the internal operation of the Performance Schema code:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68892952"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> PERFORMANCE_SCHEMA <span class="token keyword">STATUS</span>\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Type<span class="token punctuation">:</span> performance_schema
Name<span class="token punctuation">:</span> events_waits_history.size
Status<span class="token punctuation">:</span> 76
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 4. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Type<span class="token punctuation">:</span> performance_schema
Name<span class="token punctuation">:</span> events_waits_history.count
Status<span class="token punctuation">:</span> 10000
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Type<span class="token punctuation">:</span> performance_schema
Name<span class="token punctuation">:</span> events_waits_history.memory
Status<span class="token punctuation">:</span> 760000
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 57. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Type<span class="token punctuation">:</span> performance_schema
Name<span class="token punctuation">:</span> performance_schema.memory
Status<span class="token punctuation">:</span> 26459600
...</span></code></pre>
</div>
<p>
This statement is intended to help the DBA understand the
effects that different Performance Schema options have on memory
requirements.
</p>
<p>
<code class="literal">
Name
</code>
values consist of two parts, which name
an internal buffer and a buffer attribute, respectively.
Interpret buffer names as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An internal buffer that is not exposed as a table is named
within parentheses. Examples:
<code class="literal">
(pfs_cond_class).size
</code>
,
<code class="literal">
(pfs_mutex_class).memory
</code>
.
</p>
</li>
<li class="listitem">
<p>
An internal buffer that is exposed as a table in the
<code class="literal">
performance_schema
</code>
database is named
after the table, without parentheses. Examples:
<code class="literal">
events_waits_history.size
</code>
,
<code class="literal">
mutex_instances.count
</code>
.
</p>
</li>
<li class="listitem">
<p>
A value that applies to the Performance Schema as a whole
begins with
<code class="literal">
performance_schema
</code>
. Example:
<code class="literal">
performance_schema.memory
</code>
.
</p>
</li>
</ul>
</div>
<p>
Buffer attributes have these meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
size
</code>
is the size of the internal record
used by the implementation, such as the size of a row in a
table.
<code class="literal">
size
</code>
values cannot be changed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
count
</code>
is the number of internal records,
such as the number of rows in a table.
<code class="literal">
count
</code>
values can be changed using
Performance Schema configuration options.
</p>
</li>
<li class="listitem">
<p>
For a table,
<code class="literal">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.memory
</code>
is the product of
<code class="literal">
size
</code>
and
<code class="literal">
count
</code>
. For the Performance Schema as a
whole,
<code class="literal">
performance_schema.memory
</code>
is the
sum of all the memory used (the sum of all other
<code class="literal">
memory
</code>
values).
</p>
</li>
</ul>
</div>
<p>
In some cases, there is a direct relationship between a
Performance Schema configuration parameter and a
<code class="literal">
SHOW
ENGINE
</code>
value. For example,
<code class="literal">
events_waits_history_long.count
</code>
corresponds
to
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_long_size">
<code class="literal">
performance_schema_events_waits_history_long_size
</code>
</a>
.
In other cases, the relationship is more complex. For example,
<code class="literal">
events_waits_history.count
</code>
corresponds to
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_size">
<code class="literal">
performance_schema_events_waits_history_size
</code>
</a>
(the number of rows per thread) multiplied by
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances">
<code class="literal">
performance_schema_max_thread_instances
</code>
</a>
(the number of threads).
</p>
<p>
<a name="show-engine-ndb-status">
</a>
<b>
SHOW ENGINE NDB STATUS.
</b>
If the server has the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage
engine enabled,
<code class="literal">
SHOW ENGINE NDB STATUS
</code>
displays cluster status information such as the number of
connected data nodes, the cluster connectstring, and cluster
binary log epochs, as well as counts of various Cluster API
objects created by the MySQL Server when connected to the
cluster. Sample output from this statement is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61156053"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">ENGINE</span> <span class="token keyword">NDB</span> <span class="token keyword">STATUS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Type <span class="token punctuation">|</span> Name <span class="token punctuation">|</span> Status <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token operator">|</span> <span class="token keyword">ndbcluster</span> <span class="token operator">|</span> <span class="token keyword">connection</span> <span class="token operator">|</span> cluster_node_id<span class="token operator">=</span><span class="token number">7</span><span class="token punctuation">,</span>
connected_host<span class="token operator">=</span><span class="token number">198.51</span><span class="token punctuation">.</span><span class="token number">100.103</span><span class="token punctuation">,</span> connected_port<span class="token operator">=</span><span class="token number">1186</span><span class="token punctuation">,</span> number_of_data_nodes<span class="token operator">=</span><span class="token number">4</span><span class="token punctuation">,</span>
number_of_ready_data_nodes<span class="token operator">=</span><span class="token number">3</span><span class="token punctuation">,</span> connect_count<span class="token operator">=</span><span class="token number">0</span> <span class="token operator">|</span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbTransaction <span class="token punctuation">|</span> created=6, free=0, sizeof=212 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbOperation <span class="token punctuation">|</span> created=8, free=8, sizeof=660 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbIndexScanOperation <span class="token punctuation">|</span> created=1, free=1, sizeof=744 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbIndexOperation <span class="token punctuation">|</span> created=0, free=0, sizeof=664 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbRecAttr <span class="token punctuation">|</span> created=1285, free=1285, sizeof=60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbApiSignal <span class="token punctuation">|</span> created=16, free=16, sizeof=136 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbLabel <span class="token punctuation">|</span> created=0, free=0, sizeof=196 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbBranch <span class="token punctuation">|</span> created=0, free=0, sizeof=24 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbSubroutine <span class="token punctuation">|</span> created=0, free=0, sizeof=68 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbCall <span class="token punctuation">|</span> created=0, free=0, sizeof=16 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbBlob <span class="token punctuation">|</span> created=1, free=1, sizeof=264 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ndbcluster <span class="token punctuation">|</span> NdbReceiver <span class="token punctuation">|</span> created=4, free=0, sizeof=68 <span class="token punctuation">|</span></span>
<span class="token operator">|</span> <span class="token keyword">ndbcluster</span> <span class="token operator">|</span> <span class="token keyword">binlog</span> <span class="token operator">|</span> latest_epoch<span class="token operator">=</span><span class="token number">155467</span><span class="token punctuation">,</span> latest_trans_epoch<span class="token operator">=</span><span class="token number">148126</span><span class="token punctuation">,</span>
latest_received_binlog_epoch<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> latest_handled_binlog_epoch<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span>
latest_applied_binlog_epoch<span class="token operator">=</span><span class="token number">0</span> <span class="token operator">|</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The
<code class="literal">
Status
</code>
column in each of these rows
provides information about the MySQL server's connection to
the cluster and about the cluster binary log's status,
respectively. The
<code class="literal">
Status
</code>
information is in
the form of comma-delimited set of name-value pairs.
</p>
<p>
The
<code class="literal">
connection
</code>
row's
<code class="literal">
Status
</code>
column contains the name-value pairs
described in the following table.
</p>
<div class="informaltable">
<table summary="Name and value pairs found in the connection row Status column in the output of the SHOW ENGINE NDB STATUS statement.">
<colgroup>
<col style="width: 40%"/>
<col style="width: 60%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Value
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
cluster_node_id
</code>
</td>
<td>
The node ID of the MySQL server in the cluster
</td>
</tr>
<tr>
<td>
<code class="literal">
connected_host
</code>
</td>
<td>
The host name or IP address of the cluster management server to which
the MySQL server is connected
</td>
</tr>
<tr>
<td>
<code class="literal">
connected_port
</code>
</td>
<td>
The port used by the MySQL server to connect to the management server
(
<code class="literal">
connected_host
</code>
)
</td>
</tr>
<tr>
<td>
<code class="literal">
number_of_data_nodes
</code>
</td>
<td>
The number of data nodes configured for the cluster (that is, the number
of
<code class="literal">
[ndbd]
</code>
sections in the cluster
<code class="filename">
config.ini
</code>
file)
</td>
</tr>
<tr>
<td>
<code class="literal">
number_of_ready_data_nodes
</code>
</td>
<td>
The number of data nodes in the cluster that are actually running
</td>
</tr>
<tr>
<td>
<code class="literal">
connect_count
</code>
</td>
<td>
The number of times this
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
has connected or
reconnected to cluster data nodes
</td>
</tr>
</tbody>
</table>
</div>
<p>
The
<code class="literal">
binlog
</code>
row's
<code class="literal">
Status
</code>
column contains information relating
to NDB Cluster Replication. The name-value pairs it contains are
described in the following table.
</p>
<div class="informaltable">
<table summary="Name and value pairs found in the binlog row Status column in the output of the SHOW ENGINE NDB STATUS statement.">
<colgroup>
<col style="width: 40%"/>
<col style="width: 60%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Value
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
latest_epoch
</code>
</td>
<td>
The most recent epoch most recently run on this MySQL server (that is,
the sequence number of the most recent transaction run on
the server)
</td>
</tr>
<tr>
<td>
<code class="literal">
latest_trans_epoch
</code>
</td>
<td>
The most recent epoch processed by the cluster's data nodes
</td>
</tr>
<tr>
<td>
<code class="literal">
latest_received_binlog_epoch
</code>
</td>
<td>
The most recent epoch received by the binary log thread
</td>
</tr>
<tr>
<td>
<code class="literal">
latest_handled_binlog_epoch
</code>
</td>
<td>
The most recent epoch processed by the binary log thread (for writing to
the binary log)
</td>
</tr>
<tr>
<td>
<code class="literal">
latest_applied_binlog_epoch
</code>
</td>
<td>
The most recent epoch actually written to the binary log
</td>
</tr>
</tbody>
</table>
</div>
<p>
See
<a class="xref" href="mysql-cluster-replication.html" title="25.7 NDB Cluster Replication">
Section 25.7, “NDB Cluster Replication”
</a>
, for more
information.
</p>
<p>
The remaining rows from the output of
<code class="literal">
SHOW ENGINE NDB
STATUS
</code>
which are most likely to prove useful in
monitoring the cluster are listed here by
<code class="literal">
Name
</code>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NdbTransaction
</code>
: The number and size of
<code class="literal">
NdbTransaction
</code>
objects that have been
created. An
<code class="literal">
NdbTransaction
</code>
is created
each time a table schema operation (such as
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
) is performed on
an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbOperation
</code>
: The number and size of
<code class="literal">
NdbOperation
</code>
objects that have been
created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbIndexScanOperation
</code>
: The number and
size of
<code class="literal">
NdbIndexScanOperation
</code>
objects
that have been created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbIndexOperation
</code>
: The number and size of
<code class="literal">
NdbIndexOperation
</code>
objects that have been
created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbRecAttr
</code>
: The number and size of
<code class="literal">
NdbRecAttr
</code>
objects that have been
created. In general, one of these is created each time a
data manipulation statement is performed by an SQL node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbBlob
</code>
: The number and size of
<code class="literal">
NdbBlob
</code>
objects that have been created.
An
<code class="literal">
NdbBlob
</code>
is created for each new
operation involving a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
column in an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NdbReceiver
</code>
: The number and size of any
<code class="literal">
NdbReceiver
</code>
object that have been
created. The number in the
<code class="literal">
created
</code>
column
is the same as the number of data nodes in the cluster to
which the MySQL server has connected.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
SHOW ENGINE NDB STATUS
</code>
returns an empty
result if no operations involving
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables have been performed
during the current session by the MySQL client accessing the
SQL node on which this statement is run.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisam-repair.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="myisam-repair">
</a>
9.6.3 How to Repair MyISAM Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045230580192">
</a>
<a class="indexterm" name="idm46045230578736">
</a>
<p>
The discussion in this section describes how to use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
on
<code class="literal">
MyISAM
</code>
tables
(extensions
<code class="filename">
.MYI
</code>
and
<code class="filename">
.MYD
</code>
).
</p>
<p>
You can also use the
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
and
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
statements to
check and repair
<code class="literal">
MyISAM
</code>
tables. See
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
, and
<a class="xref" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
Section 15.7.3.5, “REPAIR TABLE Statement”
</a>
.
</p>
<p>
Symptoms of corrupted tables include queries that abort
unexpectedly and observable errors such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Can't find file
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.MYI
</code>
(Errcode:
<em class="replaceable">
<code>
nnn
</code>
</em>
)
</p>
</li>
<li class="listitem">
<p>
Unexpected end of file
</p>
</li>
<li class="listitem">
<p>
Record file is crashed
</p>
</li>
<li class="listitem">
<p>
Got error
<em class="replaceable">
<code>
nnn
</code>
</em>
from table handler
</p>
</li>
</ul>
</div>
<p>
To get more information about the error, run
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
<em class="replaceable">
<code>
nnn
</code>
</em>
, where
<em class="replaceable">
<code>
nnn
</code>
</em>
is the error number. The
following example shows how to use
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
to
find the meanings for the most common error numbers that
indicate a problem with a table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa16515084"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">perror</span> 126 127 132 134 135 136 141 144 145
MySQL error code 126 = Index file is crashed
MySQL error code 127 = Record-file is crashed
MySQL error code 132 = Old database file
MySQL error code 134 = Record was already deleted <span class="token punctuation">(</span>or record file crashed<span class="token punctuation">)</span>
MySQL error code 135 = No more room in record file
MySQL error code 136 = No more room in index file
MySQL error code 141 = Duplicate unique key or constraint on write or update
MySQL error code 144 = Table is crashed and last repair failed
MySQL error code 145 = Table was marked as crashed and should be repaired</code></pre>
</div>
<p>
Note that error 135 (no more room in record file) and error 136
(no more room in index file) are not errors that can be fixed by
a simple repair. In this case, you must use
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
to increase the
<code class="literal">
MAX_ROWS
</code>
and
<code class="literal">
AVG_ROW_LENGTH
</code>
table option values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa7076154"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">MAX_ROWS</span><span class="token operator">=</span><em class="replaceable">xxx</em> <span class="token keyword">AVG_ROW_LENGTH</span><span class="token operator">=</span><em class="replaceable">yyy</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you do not know the current table option values, use
<a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
<code class="literal">
SHOW CREATE TABLE
</code>
</a>
.
</p>
<p>
For the other errors, you must repair your tables.
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
can usually detect and fix most
problems that occur.
</p>
<p>
The repair process involves up to three stages, described here.
Before you begin, you should change location to the database
directory and check the permissions of the table files. On Unix,
make sure that they are readable by the user that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
runs as (and to you, because you need
to access the files you are checking). If it turns out you need
to modify files, they must also be writable by you.
</p>
<p>
This section is for the cases where a table check fails (such as
those described in
<a class="xref" href="myisam-check.html" title="9.6.2 How to Check MyISAM Tables for Errors">
Section 9.6.2, “How to Check MyISAM Tables for Errors”
</a>
), or you want
to use the extended features that
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
provides.
</p>
<p>
The
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
options used for table
maintenance with are described in
<a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
</a>
.
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
also has variables that you can set
to control memory allocation that may improve performance. See
<a class="xref" href="myisamchk-memory.html" title="6.6.4.6 myisamchk Memory Usage">
Section 6.6.4.6, “myisamchk Memory Usage”
</a>
.
</p>
<p>
If you are going to repair a table from the command line, you
must first stop the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server. Note that
when you do
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin shutdown
</strong>
</span>
</a>
on a remote
server, the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server is still available
for a while after
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
returns, until
all statement-processing has stopped and all index changes have
been flushed to disk.
</p>
<p>
<span class="bold">
<strong>
Stage 1: Checking your tables
</strong>
</span>
</p>
<p>
Run
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk *.MYI
</strong>
</span>
</a>
or
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -e
*.MYI
</strong>
</span>
</a>
if you have more time. Use the
<code class="option">
-s
</code>
(silent) option to suppress unnecessary
information.
</p>
<p>
If the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server is stopped, you should
use the
<a class="link" href="myisamchk-check-options.html#option_myisamchk_update-state">
<code class="option">
--update-state
</code>
</a>
option
to tell
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to mark the table as
<span class="quote">
“
<span class="quote">
checked.
</span>
”
</span>
</p>
<p>
You have to repair only those tables for which
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
announces an error. For such
tables, proceed to Stage 2.
</p>
<p>
If you get unexpected errors when checking (such as
<code class="literal">
out
of memory
</code>
errors), or if
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
crashes, go to Stage 3.
</p>
<p>
<span class="bold">
<strong>
Stage 2: Easy safe repair
</strong>
</span>
</p>
<p>
First, try
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -r -q
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</strong>
</span>
</a>
(
<code class="option">
-r
-q
</code>
means
<span class="quote">
“
<span class="quote">
quick recovery mode
</span>
”
</span>
). This
attempts to repair the index file without touching the data
file. If the data file contains everything that it should and
the delete links point at the correct locations within the data
file, this should work, and the table is fixed. Start repairing
the next table. Otherwise, use the following procedure:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Make a backup of the data file before continuing.
</p>
</li>
<li class="listitem">
<p>
Use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -r
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</strong>
</span>
</a>
(
<code class="option">
-r
</code>
means
<span class="quote">
“
<span class="quote">
recovery mode
</span>
”
</span>
).
This removes incorrect rows and deleted rows from the data
file and reconstructs the index file.
</p>
</li>
<li class="listitem">
<p>
If the preceding step fails, use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
--safe-recover
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</strong>
</span>
</a>
. Safe recovery
mode uses an old recovery method that handles a few cases
that regular recovery mode does not (but is slower).
</p>
</li>
</ol>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you want a repair operation to go much faster, you should
set the values of the
<a class="link" href="server-system-variables.html#sysvar_sort_buffer_size">
<code class="literal">
sort_buffer_size
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
<code class="literal">
key_buffer_size
</code>
</a>
variables
each to about 25% of your available memory when running
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
.
</p>
</div>
<p>
If you get unexpected errors when repairing (such as
<code class="literal">
out of memory
</code>
errors), or if
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
crashes, go to Stage 3.
</p>
<p>
<span class="bold">
<strong>
Stage 3: Difficult repair
</strong>
</span>
</p>
<p>
You should reach this stage only if the first 16KB block in the
index file is destroyed or contains incorrect information, or if
the index file is missing. In this case, it is necessary to
create a new index file. Do so as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Move the data file to a safe place.
</p>
</li>
<li class="listitem">
<p>
Use the table description file to create new (empty) data
and index files:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa72030050"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <em class="replaceable">db_name</em></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32744611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> autocommit<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">TRUNCATE</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> quit</code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the old data file back onto the newly created data
file. (Do not just move the old file back onto the new file.
You want to retain a copy in case something goes wrong.)
</p>
</li>
</ol>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
If you are using replication, you should stop it prior to
performing the above procedure, since it involves file system
operations, and these are not logged by MySQL.
</p>
</div>
<p>
Go back to Stage 2.
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -r -q
</strong>
</span>
</a>
should
work. (This should not be an endless loop.)
</p>
<p>
You can also use the
<code class="literal">
REPAIR TABLE
<em class="replaceable">
<code>
tbl_name
</code>
</em>
USE_FRM
</code>
SQL
statement, which performs the whole procedure automatically.
There is also no possibility of unwanted interaction between a
utility and the server, because the server does all the work
when you use
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
. See
<a class="xref" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
Section 15.7.3.5, “REPAIR TABLE Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/source-installation-layout.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="source-installation-layout">
</a>
2.8.3 MySQL Layout for Source Installation
</h3>
</div>
</div>
</div>
<p>
By default, when you install MySQL after compiling it from source,
the installation step installs files under
<code class="filename">
/usr/local/mysql
</code>
. The component locations
under the installation directory are the same as for binary
distributions. See
<a class="xref" href="binary-installation.html#binary-installation-layout" title="Table 2.3 MySQL Installation Layout for Generic Unix/Linux Binary Package">
Table 2.3, “MySQL Installation Layout for Generic Unix/Linux Binary Package”
</a>
,
and
<a class="ulink" href="/doc/refman/8.0/en/windows-installation-layout.html" target="_top">
MySQL Installation Layout on Microsoft Windows
</a>
. To configure
installation locations different from the defaults, use the
options described at
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-cpudata-20sec.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-cpudata-20sec">
</a>
25.6.17.16 The ndbinfo cpudata_20sec Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045090010608">
</a>
<p>
The
<code class="literal">
cpudata_20sec
</code>
table provides data about
CPU usage per 20-second interval over the last 400 seconds.
</p>
<p>
The
<code class="literal">
cpustat
</code>
table contains the following
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
node_id
</code>
</p>
<p>
Node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
measurement_id
</code>
</p>
<p>
Measurement sequence ID; later measurements have lower IDs
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_no
</code>
</p>
<p>
CPU ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_online
</code>
</p>
<p>
1 if the CPU is currently online, otherwise 0
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_userspace_time
</code>
</p>
<p>
CPU time spent in userspace
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_idle_time
</code>
</p>
<p>
CPU time spent idle
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_system_time
</code>
</p>
<p>
CPU time spent in system time
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_interrupt_time
</code>
</p>
<p>
CPU time spent handling interrupts (hardware and software)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_exec_vm_time
</code>
</p>
<p>
CPU time spent in virtual machine execution
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
elapsed_time
</code>
</p>
<p>
Time in microseconds used for this measurement
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045089987232">
</a>
Notes
</h5>
<p>
The
<code class="literal">
cpudata_20sec
</code>
table is available only on
Linux and Solaris operating systems.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-system-definition.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-system-definition">
</a>
25.4.3.8 Defining the System
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
[system]
</code>
section is used for parameters
applying to the cluster as a whole. The
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-name">
<code class="literal">
Name
</code>
</a>
system parameter
is used with MySQL Enterprise Monitor;
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-configgenerationnumber">
<code class="literal">
ConfigGenerationNumber
</code>
</a>
and
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-primarymgmnode">
<code class="literal">
PrimaryMGMNode
</code>
</a>
are
not used in production environments. Except when using NDB
Cluster with MySQL Enterprise Monitor, is not necessary to have a
<code class="literal">
[system]
</code>
section in the
<code class="filename">
config.ini
</code>
file.
</p>
<p>
More information about these parameters can be found in the
following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-system-configgenerationnumber">
</a>
<a class="indexterm" name="idm46045114034336">
</a>
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-configgenerationnumber">
<code class="literal">
ConfigGenerationNumber
</code>
</a>
</p>
<div class="informaltable">
<a name="configgenerationnumber-system-table">
</a>
<table frame="box" rules="all" summary="ConfigGenerationNumber system configuration parameter type and value information" width="35%">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<tbody>
<tr>
<th>
Version (or later)
</th>
<td>
NDB 8.4.0
</td>
</tr>
<tr>
<th>
Type or units
</th>
<td>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Node Restart:
</strong>
</span>
Requires a
<a class="link" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
rolling
restart
</a>
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Configuration generation number. This parameter is currently
unused.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-system-name">
</a>
<a class="indexterm" name="idm46045114013968">
</a>
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-name">
<code class="literal">
Name
</code>
</a>
</p>
<div class="informaltable">
<a name="name-system-table">
</a>
<table frame="box" rules="all" summary="Name system configuration parameter type and value information" width="35%">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<tbody>
<tr>
<th>
Version (or later)
</th>
<td>
NDB 8.4.0
</td>
</tr>
<tr>
<th>
Type or units
</th>
<td>
string
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Node Restart:
</strong>
</span>
Requires a
<a class="link" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
rolling
restart
</a>
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set a name for the cluster. This parameter is required for
deployments with MySQL Enterprise Monitor; it is otherwise unused.
</p>
<p>
You can obtain the value of this parameter by checking the
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_system_name">
<code class="literal">
Ndb_system_name
</code>
</a>
status
variable. In NDB API applications, you can also retrieve it
using
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb-cluster-connection.html#ndb-ndb-cluster-connection-get-system-name" target="_top">
<code class="literal">
get_system_name()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-system-primarymgmnode">
</a>
<a class="indexterm" name="idm46045113990560">
</a>
<a class="link" href="mysql-cluster-system-definition.html#ndbparam-system-primarymgmnode">
<code class="literal">
PrimaryMGMNode
</code>
</a>
</p>
<div class="informaltable">
<a name="primarymgmnode-system-table">
</a>
<table frame="box" rules="all" summary="PrimaryMGMNode system configuration parameter type and value information" width="35%">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<tbody>
<tr>
<th>
Version (or later)
</th>
<td>
NDB 8.4.0
</td>
</tr>
<tr>
<th>
Type or units
</th>
<td>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Node Restart:
</strong>
</span>
Requires a
<a class="link" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
rolling
restart
</a>
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Node ID of the primary management node. This parameter is
currently unused.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-system-definition-restart-types">
</a>
<b>
Restart types.
</b>
Information about the restart types used by the parameter
descriptions in this section is shown in the following table:
</p>
<div class="table">
<a name="idm46045113968960">
</a>
<p class="title">
<b>
Table 25.18 NDB Cluster restart types
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 10%"/>
<col style="width: 30%"/>
<col style="width: 60%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Symbol
</th>
<th scope="col">
Restart Type
</th>
<th scope="col">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
N
</th>
<td>
Node
</td>
<td>
The parameter can be updated using a rolling restart (see
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
)
</td>
</tr>
<tr>
<th scope="row">
S
</th>
<td>
System
</td>
<td>
All cluster nodes must be shut down completely, then restarted, to
effect a change in this parameter
</td>
</tr>
<tr>
<th scope="row">
I
</th>
<td>
Initial
</td>
<td>
Data nodes must be restarted using the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
option
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-resources.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-resources">
</a>
25.6.17.52 The ndbinfo resources Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045088199376">
</a>
<p>
This table provides information about data node resource
availability and usage.
</p>
<p>
These resources are sometimes known as
<span class="firstterm">
super-pools
</span>
.
</p>
<p>
The
<code class="literal">
resources
</code>
table contains the following
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
node_id
</code>
</p>
<p>
The unique node ID of this data node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
resource_name
</code>
</p>
<p>
Name of the resource; see text.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
reserved
</code>
</p>
<p>
The amount reserved for this resource, as a number of 32KB
pages.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
used
</code>
</p>
<p>
The amount actually used by this resource, as a number of
32KB pages.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max
</code>
</p>
<p>
The maximum amount (number of 32KB pages) of this resource
that is available to this data node.
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045088184944">
</a>
Notes
</h5>
<p>
The
<code class="literal">
resource_name
</code>
can be any one of the names
shown in the following table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
RESERVED
</code>
: Reserved by the system; cannot
be overridden.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TRANSACTION_MEMORY
</code>
: Memory allocated for
transactions on this data node. This can be controlled using
the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
configuration parameter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISK_OPERATIONS
</code>
: If a log file group is
allocated, the size of the undo log buffer is used to set
the size of this resource. This resource is used only to
allocate the undo log buffer for an undo log file group;
there can only be one such group. Overallocation occurs as
needed by
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE
GROUP
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISK_RECORDS
</code>
: Records allocated for Disk
Data operations.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA_MEMORY
</code>
: Used for main memory tuples,
indexes, and hash indexes. Sum of DataMemory and
IndexMemory, plus 8 pages of 32 KB each if IndexMemory has
been set. Cannot be overallocated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
JOBBUFFER
</code>
: Used for allocating job
buffers by the NDB scheduler; cannot be overallocated. This
is approximately 2 MB per thread plus a 1 MB buffer in both
directions for all threads that can communicate. For large
configurations this consume several GB.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FILE_BUFFERS
</code>
: Used by the redo log
handler in the
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dblqh.html" target="_top">
<code class="literal">
DBLQH
</code>
</a>
kernel block; cannot be overallocated. Size is
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-nooffragmentlogparts">
<code class="literal">
NoOfFragmentLogParts
</code>
</a>
*
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redobuffer">
<code class="literal">
RedoBuffer
</code>
</a>
, plus 1
MB per log file part.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TRANSPORTER_BUFFERS
</code>
: Used for send
buffers by
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
; the sum of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-extrasendbuffermemory">
<code class="literal">
ExtraSendBufferMemory
</code>
</a>
.
This resource that can be overallocated by up to 25 percent.
<code class="literal">
TotalSendBufferMemory
</code>
is calculated by
summing the send buffer memory per node, the default value
of which is 2 MB. Thus, in a system having four data nodes
and eight API nodes, the data nodes have 12 * 2 MB send
buffer memory.
<code class="literal">
ExtraSendBufferMemory
</code>
is
used by
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
and amounts to 2 MB extra
memory per thread. Thus, with 4 LDM threads, 2 TC threads, 1
main thread, 1 replication thread, and 2 receive threads,
<code class="literal">
ExtraSendBufferMemory
</code>
is 10 * 2 MB.
Overallocation of this resource can be performed by setting
the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-sharedglobalmemory">
<code class="literal">
SharedGlobalMemory
</code>
</a>
data node configuration parameter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISK_PAGE_BUFFER
</code>
: Used for the disk page
buffer; determined by the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
configuration parameter. Cannot be overallocated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUERY_MEMORY
</code>
: Used by the
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbspj.html" target="_top">
<code class="literal">
DBSPJ
</code>
</a>
kernel block.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SCHEMA_TRANS_MEMORY
</code>
: Minimum is 2 MB; can
be overallocated to use any remaining available memory.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/controlling-optimizer.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="controlling-optimizer">
</a>
10.9 Controlling the Query Optimizer
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="controlling-query-plan-evaluation.html">
10.9.1 Controlling Query Plan Evaluation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="switchable-optimizations.html">
10.9.2 Switchable Optimizations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-hints.html">
10.9.3 Optimizer Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-hints.html">
10.9.4 Index Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="cost-model.html">
10.9.5 The Optimizer Cost Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-statistics.html">
10.9.6 Optimizer Statistics
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045224546832">
</a>
<p>
MySQL provides optimizer control through system variables that
affect how query plans are evaluated, switchable optimizations,
optimizer and index hints, and the optimizer cost model.
</p>
<p>
The server maintains histogram statistics about column values in
the
<code class="literal">
column_statistics
</code>
data dictionary table
(see
<a class="xref" href="optimizer-statistics.html" title="10.9.6 Optimizer Statistics">
Section 10.9.6, “Optimizer Statistics”
</a>
). Like other data
dictionary tables, this table is not directly accessible by users.
Instead, you can obtain histogram information by querying
<a class="link" href="information-schema-column-statistics-table.html" title="28.3.11 The INFORMATION_SCHEMA COLUMN_STATISTICS Table">
<code class="literal">
INFORMATION_SCHEMA.COLUMN_STATISTICS
</code>
</a>
,
which is implemented as a view on the data dictionary table. You
can also perform histogram management using the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
statement.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-configuring-io-capacity.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-configuring-io-capacity">
</a>
17.8.7 Configuring InnoDB I/O Capacity
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162677200">
</a>
<a class="indexterm" name="idm46045162676128">
</a>
<p>
The
<code class="literal">
InnoDB
</code>
master thread and other threads
perform various tasks in the background, most of which are I/O
related, such as flushing dirty pages from the buffer pool and
writing changes from the change buffer to the appropriate
secondary indexes.
<code class="literal">
InnoDB
</code>
attempts to perform
these tasks in a way that does not adversely affect the normal
working of the server. It tries to estimate the available I/O
bandwidth and tune its activities to take advantage of available
capacity.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
variable
defines the overall I/O capacity available to
<code class="literal">
InnoDB
</code>
. It should be set to approximately the
number of I/O operations that the system can perform per second
(IOPS). When
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
is set,
<code class="literal">
InnoDB
</code>
estimates the I/O bandwidth
available for background tasks based on the set value.
</p>
<p>
You can set
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
to
a value of 100 or greater. The default value is
<code class="literal">
10000
</code>
. Typically, faster hard drives, RAID
configurations, and solid state drives (SSDs) benefit from higher
values than do lower-end storage devices, such as hard drives up
to 7200 RPMs.
</p>
<p>
Ideally, keep the setting as low as practical, but not so low that
background activities fall behind. If the value is too high, data
is removed from the buffer pool and change buffer too quickly for
caching to provide a significant benefit. For busy systems capable
of higher I/O rates, you can set a higher value to help the server
handle the background maintenance work associated with a high rate
of row changes. Generally, you can increase the value as a
function of the number of drives used for
<code class="literal">
InnoDB
</code>
I/O. For example, you can increase the
value on systems that use multiple disks or SSDs.
</p>
<p>
Although you can specify a high value such as a million, in
practice such large values have little benefit. Generally, a value
higher than 20000 is not recommended unless you are certain that
lower values are insufficient for your workload. See also the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
option
that automatically increases this value when flushing falls
behind.
</p>
<p>
Consider write workload when tuning
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
. Systems with
large write workloads are likely to benefit from a higher setting.
A lower setting may be sufficient for systems with a small write
workload.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
setting is
not a per buffer pool instance setting. Available I/O capacity is
distributed equally among buffer pool instances for flushing
activities.
</p>
<p>
You can set the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
value in the
MySQL option file (
<code class="literal">
my.cnf
</code>
or
<code class="literal">
my.ini
</code>
) or modify it at runtime using a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET GLOBAL
</code>
</a>
statement, which requires privileges sufficient to set global
system variables. See
<a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
Section 7.1.9.1, “System Variable Privileges”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-ignore-io-capacity">
</a>
Ignoring I/O Capacity at Checkpoints
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_sync">
<code class="literal">
innodb_flush_sync
</code>
</a>
variable,
which is enabled by default, causes the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
setting to
be ignored during bursts of I/O activity that occur at
<a class="link" href="glossary.html#glos_checkpoint" title="checkpoint">
checkpoints
</a>
. To adhere to
the I/O rate defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
settings, disable
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_sync">
<code class="literal">
innodb_flush_sync
</code>
</a>
.
</p>
<p>
You can set the
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_sync">
<code class="literal">
innodb_flush_sync
</code>
</a>
value in the
MySQL option file (
<code class="literal">
my.cnf
</code>
or
<code class="literal">
my.ini
</code>
) or modify it at runtime using a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
statement, which requires privileges sufficient
to set global system variables. See
<a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
Section 7.1.9.1, “System Variable Privileges”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-io-capacity-maximum">
</a>
Configuring an I/O Capacity Maximum
</h4>
</div>
</div>
</div>
<p>
If flushing activity falls behind,
<code class="literal">
InnoDB
</code>
can
flush more aggressively, at a higher rate of I/O operations per
second (IOPS) than defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
variable.
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
variable defines a maximum number of IOPS performed by
<code class="literal">
InnoDB
</code>
background tasks in such situations.
</p>
<p>
If you specify an
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
setting at
startup but do not specify a value for
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
defaults
to twice the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
.
</p>
<p>
When configuring
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
, twice
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
is often
a good starting point. As with the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
setting,
keep the setting as low as practical, but not so low that
<code class="literal">
InnoDB
</code>
cannot sufficiently extend rate of
IOPS beyond the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
setting.
</p>
<p>
Consider write workload when tuning
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
. Systems
with large write workloads may benefit from a higher setting. A
lower setting may be sufficient for systems with a small write
workload.
</p>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
cannot
be set to a value lower than the
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
value.
</p>
<p>
Setting
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
to
<code class="literal">
DEFAULT
</code>
using a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement (
<code class="literal">
SET GLOBAL
innodb_io_capacity_max=DEFAULT
</code>
) sets
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
to the
default value. Before MySQL 8.4, this set it to the maximum
value instead of the default value.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
limit applies to all buffer pool instances. It is not a per
buffer pool instance setting.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/introduction.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="introduction">
</a>
Chapter 1 General Information
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="manual-info.html">
1.1 About This Manual
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="what-is.html">
1.2 Overview of the MySQL Database Management System
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="what-is-mysql.html">
1.2.1 What is MySQL?
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="features.html">
1.2.2 The Main Features of MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="history.html">
1.2.3 History of MySQL
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-releases.html">
1.3 MySQL Releases: Innovation and LTS
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-nutshell.html">
1.4 What Is New in MySQL 8.4 since MySQL 8.0
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="added-deprecated-removed.html">
1.5 Server and Status Variables and Options Added, Deprecated, or Removed in
MySQL 8.4 since 8.0
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bug-reports.html">
1.6 How to Report Bugs or Problems
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="compatibility.html">
1.7 MySQL Standards Compliance
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="extensions-to-ansi.html">
1.7.1 MySQL Extensions to Standard SQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="differences-from-ansi.html">
1.7.2 MySQL Differences from Standard SQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="constraints.html">
1.7.3 How MySQL Deals with Constraints
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<a class="indexterm" name="idm46045340959232">
</a>
<a class="indexterm" name="idm46045340958160">
</a>
<p>
The MySQL software delivers a very fast, multithreaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL
Server is intended for mission-critical, heavy-load production
systems as well as for embedding into mass-deployed software. Oracle
is a registered trademark of Oracle Corporation and/or its
affiliates. MySQL is a trademark of Oracle Corporation and/or its
affiliates, and shall not be used by Customer without Oracle's
express written authorization. Other names may be trademarks of
their respective owners.
</p>
<p>
The MySQL software is Dual Licensed. Users can choose to use the
MySQL software as an Open Source product under the terms of the GNU
General Public License (
<a class="ulink" href="http://www.fsf.org/licenses/" target="_blank">
http://www.fsf.org/licenses/
</a>
)
or can purchase a standard commercial license from Oracle. See
<a class="ulink" href="http://www.mysql.com/company/legal/licensing/" target="_blank">
http://www.mysql.com/company/legal/licensing/
</a>
for
more information on our licensing policies.
</p>
<p>
The following list describes some sections of particular interest in
this manual:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For a discussion of MySQL Database Server capabilities, see
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
.
</p>
</li>
<li class="listitem">
<p>
For an overview of new MySQL features, see
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
. For information about the
changes in each version, see the
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
Release
Notes
</a>
.
</p>
</li>
<li class="listitem">
<p>
For installation instructions, see
<a class="xref" href="installing.html" title="Chapter 2 Installing MySQL">
Chapter 2,
<i>
Installing MySQL
</i>
</a>
.
For information about upgrading MySQL, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For a tutorial introduction to the MySQL Database Server, see
<a class="xref" href="tutorial.html" title="Chapter 5 Tutorial">
Chapter 5,
<i>
Tutorial
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about configuring and administering MySQL
Server, see
<a class="xref" href="server-administration.html" title="Chapter 7 MySQL Server Administration">
Chapter 7,
<i>
MySQL Server Administration
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about security in MySQL, see
<a class="xref" href="security.html" title="Chapter 8 Security">
Chapter 8,
<i>
Security
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about setting up replication servers, see
<a class="xref" href="replication.html" title="Chapter 19 Replication">
Chapter 19,
<i>
Replication
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about MySQL Enterprise, the commercial MySQL
release with advanced features and management tools, see
<a class="xref" href="mysql-enterprise.html" title="Chapter 32 MySQL Enterprise Edition">
Chapter 32,
<i>
MySQL Enterprise Edition
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For answers to a number of questions that are often asked
concerning the MySQL Database Server and its capabilities, see
<a class="xref" href="faqs.html" title="Appendix A MySQL 8.4 Frequently Asked Questions">
Appendix A,
<i>
MySQL 8.4 Frequently Asked Questions
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For a history of new features and bug fixes, see the
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
Release
Notes
</a>
.
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045335350160">
</a>
<a class="indexterm" name="idm46045335348768">
</a>
<a class="indexterm" name="idm46045335347376">
</a>
<a class="indexterm" name="idm46045335345984">
</a>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
To report problems or bugs, please use the instructions at
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
. If you find a security bug in MySQL
Server, please let us know immediately by sending an email message
to
<code class="email">
<
<a class="email" href="mailto:[email protected]">
[email protected]
</a>
>
</code>
.
<span class="emphasis">
<em>
Exception
</em>
</span>
: Support customers should report
all problems, including security bugs, to Oracle Support.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-interfaces.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="error-interfaces">
</a>
B.2 Error Information Interfaces
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045054701616">
</a>
<a class="indexterm" name="idm46045054700160">
</a>
<p>
Error messages can originate on the server side or the client
side, and each error message includes an error code, SQLSTATE
value, and message string, as described in
<a class="xref" href="error-message-elements.html" title="B.1 Error Message Sources and Elements">
Section B.1, “Error Message Sources and Elements”
</a>
. For lists of
server-side, client-side, and global (shared between server and
clients) errors, see
<a class="ulink" href="/doc/mysql-errors/8.4/en/" target="_top">
MySQL 8.4 Error Message Reference
</a>
.
</p>
<p>
For error checking from within programs, use error code numbers or
symbols, not error message strings. Message strings do not change
often, but it is possible. Also, if the database administrator
changes the language setting, that affects the language of message
strings; see
<a class="xref" href="error-message-language.html" title="12.12 Setting the Error Message Language">
Section 12.12, “Setting the Error Message Language”
</a>
.
</p>
<p>
Error information in MySQL is available in the server error log,
at the SQL level, from within client programs, and at the command
line.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="error-interfaces.html#error-interface-log" title="Error Log">
Error Log
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-interfaces.html#error-interface-sql" title="SQL Error Message Interface">
SQL Error Message Interface
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-interfaces.html#error-interface-client" title="Client Error Message Interface">
Client Error Message Interface
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-interfaces.html#error-interface-command" title="Command-Line Error Message Interface">
Command-Line Error Message Interface
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="error-interface-log">
</a>
Error Log
</h3>
</div>
</div>
</div>
<p>
On the server side, some messages are intended for the error
log. For information about configuring where and how the server
writes the log, see
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
.
</p>
<p>
Other server error messages are intended to be sent to client
programs and are available as described in
<a class="xref" href="error-interfaces.html#error-interface-client" title="Client Error Message Interface">
Client Error Message Interface
</a>
.
</p>
<p>
The range within which a particular error code lies determines
whether the server writes an error message to the error log or
sends it to clients. For information about these ranges, see
<a class="xref" href="error-message-elements.html#error-code-ranges" title="Error Code Ranges">
Error Code Ranges
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="error-interface-sql">
</a>
SQL Error Message Interface
</h3>
</div>
</div>
</div>
<p>
At the SQL level, there are several sources of error information
in MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL statement warning and error information is available
through the
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW WARNINGS
</code>
</a>
and
<a class="link" href="show-errors.html" title="15.7.7.18 SHOW ERRORS Statement">
<code class="literal">
SHOW ERRORS
</code>
</a>
statements. The
<a class="link" href="server-system-variables.html#sysvar_warning_count">
<code class="literal">
warning_count
</code>
</a>
system
variable indicates the number of errors, warnings, and notes
(with notes excluded if the
<a class="link" href="server-system-variables.html#sysvar_sql_notes">
<code class="literal">
sql_notes
</code>
</a>
system variable
is disabled). The
<a class="link" href="server-system-variables.html#sysvar_error_count">
<code class="literal">
error_count
</code>
</a>
system variable
indicates the number of errors. Its value excludes warnings
and notes.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
statement
may be used to inspect the diagnostic information in the
diagnostics area. See
<a class="xref" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
Section 15.6.7.3, “GET DIAGNOSTICS Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
<code class="literal">
SHOW REPLICA STATUS
</code>
</a>
statement
output includes information about replication errors
occurring on replica servers.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE
INNODB STATUS
</code>
</a>
statement output includes
information about the most recent foreign key error if a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement for an
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
table fails.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="error-interface-client">
</a>
Client Error Message Interface
</h3>
</div>
</div>
</div>
<p>
Client programs receive errors from two sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Errors that originate on the client side from within the
MySQL client library.
</p>
</li>
<li class="listitem">
<p>
Errors that originate on the server side and are sent to the
client by the server. These are received within the client
library, which makes them available to the host client
program.
</p>
</li>
</ul>
</div>
<p>
The range within which a particular error code lies determines
whether it originated from within the client library or was
received by the client from the server. For information about
these ranges, see
<a class="xref" href="error-message-elements.html#error-code-ranges" title="Error Code Ranges">
Error Code Ranges
</a>
.
</p>
<p>
Regardless of whether an error originates from within the client
library or is received from the server, a MySQL client program
obtains the error code, SQLSTATE value, message string, and
other related information by calling C API functions in the
client library:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="/doc/c-api/8.4/en/mysql-errno.html" target="_top">
<code class="literal">
mysql_errno()
</code>
</a>
returns the
MySQL error code.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/c-api/8.4/en/mysql-sqlstate.html" target="_top">
<code class="literal">
mysql_sqlstate()
</code>
</a>
returns the
SQLSTATE value.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/c-api/8.4/en/mysql-error.html" target="_top">
<code class="literal">
mysql_error()
</code>
</a>
returns the
message string.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/c-api/8.4/en/mysql-stmt-errno.html" target="_top">
<code class="literal">
mysql_stmt_errno()
</code>
</a>
,
<a class="ulink" href="/doc/c-api/8.4/en/mysql-stmt-sqlstate.html" target="_top">
<code class="literal">
mysql_stmt_sqlstate()
</code>
</a>
, and
<a class="ulink" href="/doc/c-api/8.4/en/mysql-stmt-error.html" target="_top">
<code class="literal">
mysql_stmt_error()
</code>
</a>
are the
corresponding error functions for prepared statements.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/c-api/8.4/en/mysql-warning-count.html" target="_top">
<code class="literal">
mysql_warning_count()
</code>
</a>
returns the number of errors, warnings, and notes for the
most recent statement.
</p>
</li>
</ul>
</div>
<p>
For descriptions of the client library error functions, see
<a class="ulink" href="/doc/c-api/8.4/en/" target="_top">
MySQL 8.4 C API Developer Guide
</a>
.
</p>
<p>
A MySQL client program may respond to an error in varying ways.
The client may display the error message so the user can take
corrective measures, internally attempt to resolve or retry a
failed operation, or take other action. For example, (using the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client), a failure to connect to the
server might result in this message:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa35939543"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-h</span> no-such-host
<span class="token output">ERROR 2005 (HY000)<span class="token punctuation">:</span> Unknown MySQL server host 'no-such-host' (-2)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="error-interface-command">
</a>
Command-Line Error Message Interface
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
program provides information from
the command line about error numbers. See
<a class="xref" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
Section 6.8.1, “perror — Display MySQL Error Message Information”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa30541227"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">perror</span> 1231
MySQL error code MY-001231 <span class="token punctuation">(</span>ER_WRONG_VALUE_FOR_VAR<span class="token punctuation">)</span><span class="token punctuation">:</span> Variable <span class="token atrule">'%-.64s'</span>
can<span class="token atrule">'t be set to the value of '</span>%-<span class="token punctuation">.</span>200s'</code></pre>
</div>
<p>
For MySQL NDB Cluster errors, use
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
.
See
<a class="xref" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
Section 25.5.16, “ndb_perror — Obtain NDB Error Message Information”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa19928922"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_perror</span> 323
NDB error code 323<span class="token punctuation">:</span> Invalid nodegroup id<span class="token punctuation">,</span> nodegroup already existing<span class="token punctuation">:</span>
Permanent error<span class="token punctuation">:</span> Application error</code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-literal.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-literal">
</a>
12.3.6 Character String Literal Character Set and Collation
</h3>
</div>
</div>
</div>
<p>
Every character string literal has a character set and a
collation.
</p>
<p>
For the simple statement
<code class="literal">
SELECT
'
<em class="replaceable">
<code>
string
</code>
</em>
'
</code>
, the string has
the connection default character set and collation defined by
the
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
system
variables.
</p>
<p>
A character string literal may have an optional character set
introducer and
<code class="literal">
COLLATE
</code>
clause, to designate
it as a string that uses a particular character set and
collation:
</p>
<a class="indexterm" name="idm46045217702352">
</a>
<a class="indexterm" name="idm46045217700864">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78815256"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">[</span>_<em class="replaceable">charset_name</em><span class="token punctuation">]</span><span class="token string">'<em class="replaceable">string</em>'</span> <span class="token punctuation">[</span><span class="token keyword">COLLATE</span> <em class="replaceable">collation_name</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
The
<code class="literal">
_
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
expression is formally called an
<span class="emphasis">
<em>
introducer
</em>
</span>
. It tells the parser,
<span class="quote">
“
<span class="quote">
the
string that follows uses character set
<em class="replaceable">
<code>
charset_name
</code>
</em>
.
</span>
”
</span>
An introducer
does not change the string to the introducer character set like
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
would do. It does not
change the string value, although padding may occur. The
introducer is just a signal. See
<a class="xref" href="charset-introducer.html" title="12.3.8 Character Set Introducers">
Section 12.3.8, “Character Set Introducers”
</a>
.
</p>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87892012"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token string">'abc'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> _latin1<span class="token string">'abc'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> _binary<span class="token string">'abc'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> _utf8mb4<span class="token string">'abc'</span> <span class="token keyword">COLLATE</span> utf8mb4_danish_ci<span class="token punctuation">;</span></code></pre>
</div>
<p>
Character set introducers and the
<code class="literal">
COLLATE
</code>
clause are implemented according to standard SQL specifications.
</p>
<p>
MySQL determines the character set and collation of a character
string literal in the following manner:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If both
<em class="replaceable">
<code>
_charset_name
</code>
</em>
and
<code class="literal">
COLLATE
<em class="replaceable">
<code>
collation_name
</code>
</em>
</code>
are
specified, character set
<em class="replaceable">
<code>
charset_name
</code>
</em>
and collation
<em class="replaceable">
<code>
collation_name
</code>
</em>
are used.
<em class="replaceable">
<code>
collation_name
</code>
</em>
must be a
permitted collation for
<em class="replaceable">
<code>
charset_name
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
_charset_name
</code>
</em>
is specified but
<code class="literal">
COLLATE
</code>
is not specified, character set
<em class="replaceable">
<code>
charset_name
</code>
</em>
and its default
collation are used. To see the default collation for each
character set, use the
<a class="link" href="show-character-set.html" title="15.7.7.4 SHOW CHARACTER SET Statement">
<code class="literal">
SHOW CHARACTER
SET
</code>
</a>
statement or query the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-character-sets-table.html" title="28.3.4 The INFORMATION_SCHEMA CHARACTER_SETS Table">
<code class="literal">
CHARACTER_SETS
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
_charset_name
</code>
</em>
is not specified
but
<code class="literal">
COLLATE
<em class="replaceable">
<code>
collation_name
</code>
</em>
</code>
is
specified, the connection default character set given by the
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
system variable and collation
<em class="replaceable">
<code>
collation_name
</code>
</em>
are used.
<em class="replaceable">
<code>
collation_name
</code>
</em>
must be a
permitted collation for the connection default character
set.
</p>
</li>
<li class="listitem">
<p>
Otherwise (neither
<em class="replaceable">
<code>
_charset_name
</code>
</em>
nor
<code class="literal">
COLLATE
<em class="replaceable">
<code>
collation_name
</code>
</em>
</code>
is
specified), the connection default character set and
collation given by the
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
system variables are used.
</p>
</li>
</ul>
</div>
<p>
Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A nonbinary string with
<code class="literal">
latin1
</code>
character
set and
<code class="literal">
latin1_german1_ci
</code>
collation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29226320"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> _latin1<span class="token string">'Müller'</span> <span class="token keyword">COLLATE</span> latin1_german1_ci<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A nonbinary string with
<code class="literal">
utf8mb4
</code>
character
set and its default collation (that is,
<code class="literal">
utf8mb4_0900_ai_ci
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35806966"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> _utf8mb4<span class="token string">'Müller'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A binary string with
<code class="literal">
binary
</code>
character set
and its default collation (that is,
<code class="literal">
binary
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91366553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> _binary<span class="token string">'Müller'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A nonbinary string with the connection default character set
and
<code class="literal">
utf8mb4_0900_ai_ci
</code>
collation (fails
if the connection character set is not
<code class="literal">
utf8mb4
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12154981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token string">'Müller'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A string with the connection default character set and
collation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa19823620"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token string">'Müller'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
An introducer indicates the character set for the following
string, but does not change how the parser performs escape
processing within the string. Escapes are always interpreted by
the parser according to the character set given by
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
.
</p>
<p>
The following examples show that escape processing occurs using
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
even
in the presence of an introducer. The examples use
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET NAMES
</code>
</a>
(which changes
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
, as
discussed in
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
), and display
the resulting strings using the
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
function so that the exact
string contents can be seen.
</p>
<p>
Example 1:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38895921"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> latin1<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'à\n'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_sjis<span class="token string">'à\n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX('à\n') <span class="token punctuation">|</span> HEX(_sjis'à\n') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> E00A <span class="token punctuation">|</span> E00A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Here,
<code class="literal">
à
</code>
(hexadecimal value
<code class="literal">
E0
</code>
) is followed by
<code class="literal">
\n
</code>
, the
escape sequence for newline. The escape sequence is interpreted
using the
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
value
of
<code class="literal">
latin1
</code>
to produce a literal newline
(hexadecimal value
<code class="literal">
0A
</code>
). This happens even for
the second string. That is, the
<code class="literal">
_sjis
</code>
introducer does not affect the parser's escape processing.
</p>
<p>
Example 2:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90261611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> sjis<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'à\n'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_latin1<span class="token string">'à\n'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX('à\n') <span class="token punctuation">|</span> HEX(_latin1'à\n') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> E05C6E <span class="token punctuation">|</span> E05C6E <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Here,
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
is
<code class="literal">
sjis
</code>
, a character set in which the
sequence of
<code class="literal">
à
</code>
followed by
<code class="literal">
\
</code>
(hexadecimal values
<code class="literal">
05
</code>
and
<code class="literal">
5C
</code>
) is a valid multibyte character.
Hence, the first two bytes of the string are interpreted as a
single
<code class="literal">
sjis
</code>
character, and the
<code class="literal">
\
</code>
is not interpreted as an escape character.
The following
<code class="literal">
n
</code>
(hexadecimal value
<code class="literal">
6E
</code>
) is not interpreted as part of an escape
sequence. This is true even for the second string; the
<code class="literal">
_latin1
</code>
introducer does not affect escape
processing.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/keyring-okv-plugin.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="keyring-okv-plugin">
</a>
8.4.4.6 Using the keyring_okv KMIP Plugin
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240680944">
</a>
<a class="indexterm" name="idm46045240679888">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
keyring_okv
</code>
plugin is an extension
included in MySQL Enterprise Edition, a commercial product. To learn more about
commercial products, see
<a class="ulink" href="https://www.mysql.com/products/" target="_blank">
https://www.mysql.com/products/
</a>
.
</p>
</div>
<p>
The Key Management Interoperability Protocol (KMIP) enables
communication of cryptographic keys between a key management
server and its clients. The
<code class="literal">
keyring_okv
</code>
keyring plugin uses the KMIP 1.1 protocol to communicate
securely as a client of a KMIP back end. Keyring material is
generated exclusively by the back end, not by
<code class="literal">
keyring_okv
</code>
. The plugin works with these
KMIP-compatible products:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Oracle Key Vault
</p>
</li>
<li class="listitem">
<p>
Gemalto SafeNet KeySecure Appliance
</p>
</li>
<li class="listitem">
<p>
Townsend Alliance Key Manager
</p>
</li>
<li class="listitem">
<p>
Entrust KeyControl
</p>
</li>
</ul>
</div>
<p>
Each MySQL Server instance must be registered separately as a
client for KMIP. If two or more MySQL Server instances use the
same set of credentials, they can interfere with each other’s
functioning.
</p>
<p>
The
<code class="literal">
keyring_okv
</code>
plugin supports the functions
that comprise the standard MySQL Keyring service interface.
Keyring operations performed by those functions are accessible
at two levels:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL interface: In SQL statements, call the functions
described in
<a class="xref" href="keyring-functions-general-purpose.html" title="8.4.4.12 General-Purpose Keyring Key-Management Functions">
Section 8.4.4.12, “General-Purpose Keyring Key-Management Functions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
C interface: In C-language code, call the keyring service
functions described in
<a class="xref" href="keyring-service.html" title="7.6.9.2 The Keyring Service">
Section 7.6.9.2, “The Keyring Service”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Example (using the SQL interface):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56991243"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> keyring_key_generate<span class="token punctuation">(</span><span class="token string">'MyKey'</span><span class="token punctuation">,</span> <span class="token string">'AES'</span><span class="token punctuation">,</span> <span class="token number">32</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> keyring_key_remove<span class="token punctuation">(</span><span class="token string">'MyKey'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For information about the characteristics of key values
permitted by
<code class="literal">
keyring_okv
</code>
,
<a class="xref" href="keyring-key-types.html" title="8.4.4.10 Supported Keyring Key Types and Lengths">
Section 8.4.4.10, “Supported Keyring Key Types and Lengths”
</a>
.
</p>
<p>
To install
<code class="literal">
keyring_okv
</code>
, use the general
instructions found in
<a class="xref" href="keyring-plugin-installation.html" title="8.4.4.3 Keyring Plugin Installation">
Section 8.4.4.3, “Keyring Plugin Installation”
</a>
, together with the
configuration information specific to
<code class="literal">
keyring_okv
</code>
found here.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-configuration" title="General keyring_okv Configuration">
General keyring_okv Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-oracle-key-vault" title="Configuring keyring_okv for Oracle Key Vault">
Configuring keyring_okv for Oracle Key Vault
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-keysecure" title="Configuring keyring_okv for Gemalto SafeNet KeySecure Appliance">
Configuring keyring_okv for Gemalto SafeNet KeySecure Appliance
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-alliance" title="Configuring keyring_okv for Townsend Alliance Key Manager">
Configuring keyring_okv for Townsend Alliance Key Manager
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-entrust-keycontrol" title="Configuring keyring_okv for Entrust KeyControl">
Configuring keyring_okv for Entrust KeyControl
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-encrypt-key-file" title="Password-Protecting the keyring_okv Key File">
Password-Protecting the keyring_okv Key File
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-configuration">
</a>
General keyring_okv Configuration
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240650816">
</a>
<p>
Regardless of which KMIP back end the
<code class="literal">
keyring_okv
</code>
plugin uses for keyring
storage, the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
system
variable configures the location of the directory used by
<code class="literal">
keyring_okv
</code>
for its support files. The
default value is empty, so you must set the variable to name a
properly configured directory before the plugin can
communicate with the KMIP back end. Unless you do so,
<code class="literal">
keyring_okv
</code>
writes a message to the error
log during server startup that it cannot communicate:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa34762772"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Warning] Plugin keyring_okv reported: 'For keyring_okv to be
initialized, please point the keyring_okv_conf_dir variable to a directory
containing Oracle Key Vault configuration file and ssl materials'</code></pre>
</div>
<p>
The
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
variable must name a directory that contains the following
items:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="filename">
okvclient.ora
</code>
: A file that contains
details of the KMIP back end with which
<code class="literal">
keyring_okv
</code>
communicates.
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
ssl
</code>
: A directory that contains the
certificate and key files required to establish a secure
connection with the KMIP back end:
<code class="filename">
CA.pem
</code>
,
<code class="filename">
cert.pem
</code>
, and
<code class="filename">
key.pem
</code>
. If the key file is
password-protected, the
<code class="filename">
ssl
</code>
directory
can contain a single-line text file named
<code class="filename">
password.txt
</code>
containing the password
needed to decrypt the key file.
</p>
</li>
</ul>
</div>
<p>
Both the
<code class="filename">
okvclient.ora
</code>
file and
<code class="filename">
ssl
</code>
directory with the certificate and
key files are required for
<code class="literal">
keyring_okv
</code>
to
work properly. The procedure used to populate the
configuration directory with these files depends on the KMIP
back end used with
<code class="literal">
keyring_okv
</code>
, as
described elsewhere.
</p>
<p>
The configuration directory used by
<code class="literal">
keyring_okv
</code>
as the location for its support
files should have a restrictive mode and be accessible only to
the account used to run the MySQL server. For example, on Unix
and Unix-like systems, to use the
<code class="filename">
/usr/local/mysql/mysql-keyring-okv
</code>
directory, the following commands (executed as
<code class="literal">
root
</code>
) create the directory and set its mode
and ownership:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa86268224"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">cd /usr/local/mysql
mkdir mysql-keyring-okv
chmod 750 mysql-keyring-okv
chown mysql mysql-keyring-okv
chgrp mysql mysql-keyring-okv</code></pre>
</div>
<p>
To be usable during the server startup process,
<code class="literal">
keyring_okv
</code>
must be loaded using the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option.
Also, set the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
system
variable to tell
<code class="literal">
keyring_okv
</code>
where to find
its configuration directory. For example, use these lines in
the server
<code class="filename">
my.cnf
</code>
file, adjusting the
<code class="filename">
.so
</code>
suffix and directory location for
your platform as necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa78467540"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">early-plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">keyring_okv_conf_dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mysql-keyring-okv</span></code></pre>
</div>
<p>
For additional information about
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
, see
<a class="xref" href="keyring-system-variables.html" title="8.4.4.16 Keyring System Variables">
Section 8.4.4.16, “Keyring System Variables”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-oracle-key-vault">
</a>
Configuring keyring_okv for Oracle Key Vault
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240615760">
</a>
<a class="indexterm" name="idm46045240614304">
</a>
<p>
The discussion here assumes that you are familiar with Oracle
Key Vault. Some pertinent information sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="http://www.oracle.com/technetwork/database/options/key-management/overview/index.html" target="_blank">
Oracle
Key Vault site
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="http://www.oracle.com/technetwork/database/options/key-management/documentation/index.html" target="_blank">
Oracle
Key Vault documentation
</a>
</p>
</li>
</ul>
</div>
<p>
In Oracle Key Vault terminology, clients that use Oracle Key
Vault to store and retrieve security objects are called
endpoints. To communicate with Oracle Key Vault, it is
necessary to register as an endpoint and enroll by downloading
and installing endpoint support files. Note that you must
register a separate endpoint for each MySQL Server instance.
If two or more MySQL Server instances use the same endpoint,
they can interfere with each other’s functioning.
</p>
<p>
The following procedure briefly summarizes the process of
setting up
<code class="literal">
keyring_okv
</code>
for use with Oracle
Key Vault:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create the configuration directory for the
<code class="literal">
keyring_okv
</code>
plugin to use.
</p>
</li>
<li class="listitem">
<p>
Register an endpoint with Oracle Key Vault to obtain an
enrollment token.
</p>
</li>
<li class="listitem">
<p>
Use the enrollment token to obtain the
<code class="filename">
okvclient.jar
</code>
client software
download.
</p>
</li>
<li class="listitem">
<p>
Install the client software to populate the
<code class="literal">
keyring_okv
</code>
configuration directory
that contains the Oracle Key Vault support files.
</p>
</li>
</ol>
</div>
<p>
Use the following procedure to configure
<code class="literal">
keyring_okv
</code>
and Oracle Key Vault to work
together. This description only summarizes how to interact
with Oracle Key Vault. For details, visit the
<a class="ulink" href="http://www.oracle.com/technetwork/database/options/key-management/overview/index.html" target="_blank">
Oracle
Key Vault
</a>
site and consult the
<em class="citetitle">
Oracle Key
Vault Administrator's Guide
</em>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create the configuration directory that contains the
Oracle Key Vault support files, and make sure that the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
system variable is set to name that directory (for
details, see
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-configuration" title="General keyring_okv Configuration">
General keyring_okv Configuration
</a>
).
</p>
</li>
<li class="listitem">
<p>
Log in to the Oracle Key Vault management console as a
user who has the System Administrator role.
</p>
</li>
<li class="listitem">
<p>
Select the Endpoints tab to arrive at the Endpoints page.
On the Endpoints page, click Add.
</p>
</li>
<li class="listitem">
<p>
Provide the required endpoint information and click
Register. The endpoint type should be Other. Successful
registration results in an enrollment token.
</p>
</li>
<li class="listitem">
<p>
Log out from the Oracle Key Vault server.
</p>
</li>
<li class="listitem">
<p>
Connect again to the Oracle Key Vault server, this time
without logging in. Use the endpoint enrollment token to
enroll and request the
<code class="filename">
okvclient.jar
</code>
software download. Save this file to your system.
</p>
</li>
<li class="listitem">
<p>
Install the
<code class="filename">
okvclient.jar
</code>
file using
the following command (you must have JDK 1.4 or higher):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa99523913"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">java <span class="token property">-jar</span> okvclient<span class="token punctuation">.</span>jar <span class="token property">-d</span> <em class="replaceable">dir_name</em> <span class="token punctuation">[</span><span class="token property">-v</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
The directory name following the
<code class="option">
-d
</code>
option is the location in which to install extracted
files. The
<code class="option">
-v
</code>
option, if given, causes
log information to be produced that may be useful if the
command fails.
</p>
<p>
When the command asks for an Oracle Key Vault endpoint
password, do not provide one. Instead, press
<span class="keycap">
<strong>
Enter
</strong>
</span>
. (The result is that no password is
required when the endpoint connects to Oracle Key Vault.)
</p>
<p>
The preceding command produces an
<code class="filename">
okvclient.ora
</code>
file, which should be
in this location under the directory named by the
<code class="option">
-d
</code>
option in the preceding
<span class="command">
<strong>
java
-jar
</strong>
</span>
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa59182986"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">install_dir/conf/okvclient<span class="token punctuation">.</span>ora</code></pre>
</div>
<p>
The expected file contents include lines that look like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95466085"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span>
<span class="token constant">STANDBY_SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span></code></pre>
</div>
<p>
The
<code class="literal">
SERVER
</code>
variable is mandatory, and
the
<code class="literal">
STANDBY_SERVER
</code>
variable is
optional. The
<code class="literal">
keyring_okv
</code>
plugin
attempts to communicate with the server running on the
host named by the
<code class="literal">
SERVER
</code>
variable and
falls back to
<code class="literal">
STANDBY_SERVER
</code>
if that
fails.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the existing file is not in this format, then create
a new file with the lines shown in the previous example.
Also, consider backing up the
<code class="filename">
okvclient.ora
</code>
file before you run
the
<span class="command">
<strong>
okvutil
</strong>
</span>
command. Restore the file
as needed.
</p>
</div>
<p>
You can specify more than one standby server (up to a
maximum of 64). If you do, the
<code class="literal">
keyring_okv
</code>
plugin iterates over them
until it can establish a connection, and fails if it
cannot. To add extra standby servers, edit the
<code class="filename">
okvclient.ora
</code>
file to specify the IP
addresses and port numbers of the servers as a
comma-separated list in the value of the
<code class="literal">
STANDBY_SERVER
</code>
variable. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa14977566"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">STANDBY_SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span></code></pre>
</div>
<p>
Ensure that the list of standby servers is kept short,
accurate, and up to date, and servers that are no longer
valid are removed. There is a 20-second wait for each
connection attempt, so the presence of a long list of
invalid servers can significantly affect the
<code class="literal">
keyring_okv
</code>
plugin’s connection time
and therefore the server startup time.
</p>
</li>
<li class="listitem">
<p>
Go to the Oracle Key Vault installer directory and test
the setup by running this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa50196700"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">okvutil/bin/okvutil list</code></pre>
</div>
<p>
The output should look something like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa71201063"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">Unique ID Type Identifier
255AB8DE-C97F-482C-E053-0100007F28B9 Symmetric Key -
264BF6E0-A20E-7C42-E053-0100007FB29C Symmetric Key -</code></pre>
</div>
<p>
For a fresh Oracle Key Vault server (a server without any
key in it), the output looks like this instead, to
indicate that there are no keys in the vault:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa37934248"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">no objects found</code></pre>
</div>
</li>
<li class="listitem">
<p>
Use this command to extract the
<code class="filename">
ssl
</code>
directory containing SSL materials from the
<code class="filename">
okvclient.jar
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa25035246"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">jar xf okvclient<span class="token punctuation">.</span>jar ssl</code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the Oracle Key Vault support files (the
<code class="filename">
okvclient.ora
</code>
file and the
<code class="filename">
ssl
</code>
directory) into the configuration
directory.
</p>
</li>
<li class="listitem">
<p>
(Optional) If you wish to password-protect the key file,
use the instructions in
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-encrypt-key-file" title="Password-Protecting the keyring_okv Key File">
Password-Protecting the keyring_okv Key File
</a>
.
</p>
</li>
</ol>
</div>
<p>
After completing the preceding procedure, restart the MySQL
server. It loads the
<code class="literal">
keyring_okv
</code>
plugin and
<code class="literal">
keyring_okv
</code>
uses the files in its
configuration directory to communicate with Oracle Key Vault.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-keysecure">
</a>
Configuring keyring_okv for Gemalto SafeNet KeySecure Appliance
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240543696">
</a>
<a class="indexterm" name="idm46045240542256">
</a>
<a class="indexterm" name="idm46045240540736">
</a>
<p>
Gemalto SafeNet KeySecure Appliance uses the KMIP protocol
(version 1.1 or 1.2). The
<code class="literal">
keyring_okv
</code>
keyring plugin (which supports KMIP 1.1) can use KeySecure as
its KMIP back end for keyring storage.
</p>
<p>
Use the following procedure to configure
<code class="literal">
keyring_okv
</code>
and KeySecure to work together.
The description only summarizes how to interact with
KeySecure. For details, consult the section named Add a KMIP
Server in the
<a class="ulink" href="https://www2.gemalto.com/aws-marketplace/usage/vks/uploadedFiles/Support_and_Downloads/AWS/007-012362-001-keysecure-appliance-user-guide-v7.1.0.pdf" target="_blank">
KeySecure
User Guide
</a>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create the configuration directory that contains the
KeySecure support files, and make sure that the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_okv_conf_dir">
<code class="literal">
keyring_okv_conf_dir
</code>
</a>
system variable is set to name that directory (for
details, see
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-configuration" title="General keyring_okv Configuration">
General keyring_okv Configuration
</a>
).
</p>
</li>
<li class="listitem">
<p>
In the configuration directory, create a subdirectory
named
<code class="filename">
ssl
</code>
to use for storing the
required SSL certificate and key files.
</p>
</li>
<li class="listitem">
<p>
In the configuration directory, create a file named
<code class="filename">
okvclient.ora
</code>
. It should have
following format:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa11400941"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span>
<span class="token constant">STANDBY_SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span></code></pre>
</div>
<p>
For example, if KeySecure is running on host 198.51.100.20
and listening on port 9002, and also running on
alternative host 203.0.113.125 and listening on port 8041,
the
<code class="filename">
okvclient.ora
</code>
file looks like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa23216038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">SERVER</span><span class="token attr-value"><span class="token punctuation">=</span>198.51.100.20:9002</span>
<span class="token constant">STANDBY_SERVER</span><span class="token attr-value"><span class="token punctuation">=</span>203.0.113.125:8041</span></code></pre>
</div>
<p>
You can specify more than one standby server (up to a
maximum of 64). If you do, the
<code class="literal">
keyring_okv
</code>
plugin iterates over them
until it can establish a connection, and fails if it
cannot. To add extra standby servers, edit the
<code class="filename">
okvclient.ora
</code>
file to specify the IP
addresses and port numbers of the servers as a
comma-separated list in the value of the
<code class="literal">
STANDBY_SERVER
</code>
variable. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa25666803"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">STANDBY_SERVER</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em>,<em class="replaceable">host_ip</em>:<em class="replaceable">port_num</em></span></code></pre>
</div>
<p>
Ensure that the list of standby servers is kept short,
accurate, and up to date, and servers that are no longer
valid are removed. There is a 20-second wait for each
connection attempt, so the presence of a long list of
invalid servers can significantly affect the
<code class="literal">
keyring_okv
</code>
plugin’s connection time
and therefore the server startup time.
</p>
</li>
<li class="listitem">
<p>
Connect to the KeySecure Management Console as an
administrator with credentials for Certificate Authorities
access.
</p>
</li>
<li class="listitem">
<p>
Navigate to Security >> Local CAs and create a local
certificate authority (CA).
</p>
</li>
<li class="listitem">
<p>
Go to Trusted CA Lists. Select Default and click on
Properties. Then select Edit for Trusted Certificate
Authority List and add the CA just created.
</p>
</li>
<li class="listitem">
<p>
Download the CA and save it in the
<code class="filename">
ssl
</code>
directory as a file named
<code class="filename">
CA.pem
</code>
.
</p>
</li>
<li class="listitem">
<p>
Navigate to Security >> Certificate Requests and
create a certificate. Then you can download a compressed
<span class="command">
<strong>
tar
</strong>
</span>
file containing certificate PEM
files.
</p>
</li>
<li class="listitem">
<p>
Extract the PEM files from in the downloaded file. For
example, if the file name is
<code class="filename">
csr_w_pk_pkcs8.gz
</code>
, decompress and
unpack it using this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77976260"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">tar zxvf csr_w_pk_pkcs8<span class="token punctuation">.</span>gz</code></pre>
</div>
<p>
Two files result from the extraction operation:
<code class="filename">
certificate_request.pem
</code>
and
<code class="filename">
private_key_pkcs8.pem
</code>
.
</p>
</li>
<li class="listitem">
<p>
Use this
<span class="command">
<strong>
openssl
</strong>
</span>
command to decrypt the
private key and create a file named
<code class="filename">
key.pem
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa1010699"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">openssl pkcs8 <span class="token property">-in</span> private_key_pkcs8<span class="token punctuation">.</span>pem <span class="token property">-out</span> key<span class="token punctuation">.</span>pem</code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the
<code class="filename">
key.pem
</code>
file into the
<code class="filename">
ssl
</code>
directory.
</p>
</li>
<li class="listitem">
<p>
Copy the certificate request in
<code class="filename">
certificate_request.pem
</code>
into the
clipboard.
</p>
</li>
<li class="listitem">
<p>
Navigate to Security >> Local CAs. Select the same
CA that you created earlier (the one you downloaded to
create the
<code class="filename">
CA.pem
</code>
file), and click
Sign Request. Paste the Certificate Request from the
clipboard, choose a certificate purpose of Client (the
keyring is a client of KeySecure), and click Sign Request.
The result is a certificate signed with the selected CA in
a new page.
</p>
</li>
<li class="listitem">
<p>
Copy the signed certificate to the clipboard, then save
the clipboard contents as a file named
<code class="filename">
cert.pem
</code>
in the
<code class="filename">
ssl
</code>
directory.
</p>
</li>
<li class="listitem">
<p>
(Optional) If you wish to password-protect the key file,
use the instructions in
<a class="xref" href="keyring-okv-plugin.html#keyring-okv-encrypt-key-file" title="Password-Protecting the keyring_okv Key File">
Password-Protecting the keyring_okv Key File
</a>
.
</p>
</li>
</ol>
</div>
<p>
After completing the preceding procedure, restart the MySQL
server. It loads the
<code class="literal">
keyring_okv
</code>
plugin and
<code class="literal">
keyring_okv
</code>
uses the files in its
configuration directory to communicate with KeySecure.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-alliance">
</a>
Configuring keyring_okv for Townsend Alliance Key Manager
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240485984">
</a>
<a class="indexterm" name="idm46045240484544">
</a>
<a class="indexterm" name="idm46045240483024">
</a>
<p>
Townsend Alliance Key Manager uses the KMIP protocol. The
<code class="literal">
keyring_okv
</code>
keyring plugin can use Alliance
Key Manager as its KMIP back end for keyring storage. For
additional information, see
<a class="ulink" href="https://www.townsendsecurity.com/product/encryption-key-management-mysql" target="_blank">
Alliance
Key Manager for MySQL
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-entrust-keycontrol">
</a>
Configuring keyring_okv for Entrust KeyControl
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240478096">
</a>
<a class="indexterm" name="idm46045240476640">
</a>
<a class="indexterm" name="idm46045240475136">
</a>
<p>
Entrust KeyControl uses the KMIP protocol. The
<code class="literal">
keyring_okv
</code>
keyring plugin can use Entrust
KeyControl as its KMIP back end for keyring storage. For
additional information, see the
<a class="ulink" href="https://www.entrust.com/-/media/documentation/integration-guides/oracle-mysql-enterprise-keycontrol-nshield-ig.pdf" target="_blank">
Oracle
MySQL and Entrust KeyControl with nShield HSM Integration
Guide
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-okv-encrypt-key-file">
</a>
Password-Protecting the keyring_okv Key File
</h5>
</div>
</div>
</div>
<p>
You can optionally protect the key file with a password and
supply a file containing the password to enable the key file
to be decrypted. To so do, change location to the
<code class="filename">
ssl
</code>
directory and perform these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Encrypt the
<code class="filename">
key.pem
</code>
key file. For
example, use a command like this, and enter the encryption
password at the prompts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa37987443"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">openssl</span> rsa <span class="token property">-des3</span> <span class="token property">-in</span> key<span class="token punctuation">.</span>pem <span class="token property">-out</span> key<span class="token punctuation">.</span>pem<span class="token punctuation">.</span>new
Enter PEM pass phrase<span class="token punctuation">:</span>
Verifying - Enter PEM pass phrase<span class="token punctuation">:</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Save the encryption password in a single-line text file
named
<code class="filename">
password.txt
</code>
in the
<code class="filename">
ssl
</code>
directory.
</p>
</li>
<li class="listitem">
<p>
Verify that the encrypted key file can be decrypted using
the following command. The decrypted file should display
on the console:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa22192364"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">openssl</span> rsa <span class="token property">-in</span> key<span class="token punctuation">.</span>pem<span class="token punctuation">.</span>new <span class="token property">-passin</span> file<span class="token punctuation">:</span>password<span class="token punctuation">.</span>txt</code></pre>
</div>
</li>
<li class="listitem">
<p>
Remove the original
<code class="filename">
key.pem
</code>
file and
rename
<code class="filename">
key.pem.new
</code>
to
<code class="filename">
key.pem
</code>
.
</p>
</li>
<li class="listitem">
<p>
Change the ownership and access mode of new
<code class="filename">
key.pem
</code>
file and
<code class="filename">
password.txt
</code>
file as necessary to
ensure that they have the same restrictions as other files
in the
<code class="filename">
ssl
</code>
directory.
</p>
</li>
</ol>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/string-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="string-functions">
</a>
14.8 String Functions and Operators
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="string-comparison-functions.html">
14.8.1 String Comparison Functions and Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="regexp.html">
14.8.2 Regular Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="string-functions-charset.html">
14.8.3 Character Set and Collation of Function Results
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045203861616">
</a>
<a class="indexterm" name="idm46045203860576">
</a>
<a class="indexterm" name="idm46045203859088">
</a>
<a class="indexterm" name="idm46045203858016">
</a>
<div class="table">
<a name="idm46045203856528">
</a>
<p class="title">
<b>
Table 14.12 String Functions and Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists string functions and operators.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII()
</code>
</a>
</td>
<td>
Return numeric value of left-most character
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_bin">
<code class="literal">
BIN()
</code>
</a>
</td>
<td>
Return a string containing binary representation of a number
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_bit-length">
<code class="literal">
BIT_LENGTH()
</code>
</a>
</td>
<td>
Return length of argument in bits
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
</td>
<td>
Return the character for each integer passed
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH()
</code>
</a>
</td>
<td>
Return number of characters in argument
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_character-length">
<code class="literal">
CHARACTER_LENGTH()
</code>
</a>
</td>
<td>
Synonym for CHAR_LENGTH()
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
</td>
<td>
Return concatenated string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS()
</code>
</a>
</td>
<td>
Return concatenate with separator
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT()
</code>
</a>
</td>
<td>
Return string at index number
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_export-set">
<code class="literal">
EXPORT_SET()
</code>
</a>
</td>
<td>
Return a string such that for every bit set in the value bits, you
get an on string and for every unset bit, you get an off string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD()
</code>
</a>
</td>
<td>
Index (position) of first argument in subsequent arguments
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_find-in-set">
<code class="literal">
FIND_IN_SET()
</code>
</a>
</td>
<td>
Index (position) of first argument within second argument
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_format">
<code class="literal">
FORMAT()
</code>
</a>
</td>
<td>
Return a number formatted to specified number of decimal places
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
</td>
<td>
Hexadecimal representation of decimal or string value
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_insert">
<code class="literal">
INSERT()
</code>
</a>
</td>
<td>
Insert substring at specified position up to specified number of
characters
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_instr">
<code class="literal">
INSTR()
</code>
</a>
</td>
<td>
Return the index of the first occurrence of substring
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_lcase">
<code class="literal">
LCASE()
</code>
</a>
</td>
<td>
Synonym for LOWER()
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_left">
<code class="literal">
LEFT()
</code>
</a>
</td>
<td>
Return the leftmost number of characters as specified
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
</td>
<td>
Return the length of a string in bytes
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
</td>
<td>
Simple pattern matching
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_load-file">
<code class="literal">
LOAD_FILE()
</code>
</a>
</td>
<td>
Load the named file
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE()
</code>
</a>
</td>
<td>
Return the position of the first occurrence of substring
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
</td>
<td>
Return the argument in lowercase
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_lpad">
<code class="literal">
LPAD()
</code>
</a>
</td>
<td>
Return the string argument, left-padded with the specified string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_ltrim">
<code class="literal">
LTRIM()
</code>
</a>
</td>
<td>
Remove leading spaces
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_make-set">
<code class="literal">
MAKE_SET()
</code>
</a>
</td>
<td>
Return a set of comma-separated strings that have the
corresponding bit in bits set
</td>
</tr>
<tr>
<td>
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
</td>
<td>
Perform full-text search
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID()
</code>
</a>
</td>
<td>
Return a substring starting from the specified position
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#operator_not-like">
<code class="literal">
NOT LIKE
</code>
</a>
</td>
<td>
Negation of simple pattern matching
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#operator_not-regexp">
<code class="literal">
NOT REGEXP
</code>
</a>
</td>
<td>
Negation of REGEXP
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_oct">
<code class="literal">
OCT()
</code>
</a>
</td>
<td>
Return a string containing octal representation of a number
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_octet-length">
<code class="literal">
OCTET_LENGTH()
</code>
</a>
</td>
<td>
Synonym for LENGTH()
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_ord">
<code class="literal">
ORD()
</code>
</a>
</td>
<td>
Return character code for leftmost character of the argument
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_position">
<code class="literal">
POSITION()
</code>
</a>
</td>
<td>
Synonym for LOCATE()
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_quote">
<code class="literal">
QUOTE()
</code>
</a>
</td>
<td>
Escape the argument for use in an SQL statement
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#operator_regexp">
<code class="literal">
REGEXP
</code>
</a>
</td>
<td>
Whether string matches regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#function_regexp-instr">
<code class="literal">
REGEXP_INSTR()
</code>
</a>
</td>
<td>
Starting index of substring matching regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#function_regexp-like">
<code class="literal">
REGEXP_LIKE()
</code>
</a>
</td>
<td>
Whether string matches regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#function_regexp-replace">
<code class="literal">
REGEXP_REPLACE()
</code>
</a>
</td>
<td>
Replace substrings matching regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#function_regexp-substr">
<code class="literal">
REGEXP_SUBSTR()
</code>
</a>
</td>
<td>
Return substring matching regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_repeat">
<code class="literal">
REPEAT()
</code>
</a>
</td>
<td>
Repeat a string the specified number of times
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_replace">
<code class="literal">
REPLACE()
</code>
</a>
</td>
<td>
Replace occurrences of a specified string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_reverse">
<code class="literal">
REVERSE()
</code>
</a>
</td>
<td>
Reverse the characters in a string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_right">
<code class="literal">
RIGHT()
</code>
</a>
</td>
<td>
Return the specified rightmost number of characters
</td>
</tr>
<tr>
<td>
<a class="link" href="regexp.html#operator_regexp">
<code class="literal">
RLIKE
</code>
</a>
</td>
<td>
Whether string matches regular expression
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_rpad">
<code class="literal">
RPAD()
</code>
</a>
</td>
<td>
Append string the specified number of times
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_rtrim">
<code class="literal">
RTRIM()
</code>
</a>
</td>
<td>
Remove trailing spaces
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX()
</code>
</a>
</td>
<td>
Return a soundex string
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#operator_sounds-like">
<code class="literal">
SOUNDS LIKE
</code>
</a>
</td>
<td>
Compare sounds
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_space">
<code class="literal">
SPACE()
</code>
</a>
</td>
<td>
Return a string of the specified number of spaces
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#function_strcmp">
<code class="literal">
STRCMP()
</code>
</a>
</td>
<td>
Compare two strings
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR()
</code>
</a>
</td>
<td>
Return the substring as specified
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING()
</code>
</a>
</td>
<td>
Return the substring as specified
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_substring-index">
<code class="literal">
SUBSTRING_INDEX()
</code>
</a>
</td>
<td>
Return a substring from a string before the specified number of
occurrences of the delimiter
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_trim">
<code class="literal">
TRIM()
</code>
</a>
</td>
<td>
Remove leading and trailing spaces
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_ucase">
<code class="literal">
UCASE()
</code>
</a>
</td>
<td>
Synonym for UPPER()
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
</td>
<td>
Return a string containing hex representation of a number
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
</td>
<td>
Convert to uppercase
</td>
</tr>
<tr>
<td>
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
</td>
<td>
Return the weight string for a string
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 208.719px;">
Name
</th>
<th style="width: 529.281px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
String-valued functions return
<code class="literal">
NULL
</code>
if the
length of the result would be greater than the value of the
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
system
variable. See
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
.
</p>
<p>
For functions that operate on string positions, the first position
is numbered 1.
</p>
<p>
For functions that take length arguments, noninteger arguments are
rounded to the nearest integer.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_ascii">
</a>
<p>
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203663648">
</a>
<p>
Returns the numeric value of the leftmost character of the
string
<em class="replaceable">
<code>
str
</code>
</em>
. Returns
<code class="literal">
0
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is the
empty string. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII()
</code>
</a>
works for 8-bit
characters.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31156887"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ASCII</span><span class="token punctuation">(</span><span class="token string">'2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">50</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ASCII</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">50</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ASCII</span><span class="token punctuation">(</span><span class="token string">'dx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">100</span></code></pre>
</div>
<p>
See also the
<a class="link" href="string-functions.html#function_ord">
<code class="literal">
ORD()
</code>
</a>
function.
</p>
</li>
<li class="listitem">
<a name="function_bin">
</a>
<p>
<a class="link" href="string-functions.html#function_bin">
<code class="literal">
BIN(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203645744">
</a>
<p>
Returns a string representation of the binary value of
<em class="replaceable">
<code>
N
</code>
</em>
, where
<em class="replaceable">
<code>
N
</code>
</em>
is a longlong
(
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
) number. This is
equivalent to
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV(
<em class="replaceable">
<code>
N
</code>
</em>
,10,2)
</code>
</a>
.
Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41947838"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN</span><span class="token punctuation">(</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'1100'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_bit-length">
</a>
<p>
<a class="link" href="string-functions.html#function_bit-length">
<code class="literal">
BIT_LENGTH(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203630000">
</a>
<p>
Returns the length of the string
<em class="replaceable">
<code>
str
</code>
</em>
in bits. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83399248"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_LENGTH</span><span class="token punctuation">(</span><span class="token string">'text'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">32</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_char">
</a>
<p>
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
,...
[USING
<em class="replaceable">
<code>
charset_name
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045203617216">
</a>
<p>
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
interprets each argument
<em class="replaceable">
<code>
N
</code>
</em>
as an integer and returns a
string consisting of the characters given by the code values
of those integers.
<code class="literal">
NULL
</code>
values are skipped.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26148689"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">121</span><span class="token punctuation">,</span><span class="token number">83</span><span class="token punctuation">,</span><span class="token number">81</span><span class="token punctuation">,</span><span class="token string">'76'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,121,83,81,'76') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0x4D7953514C <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">77.3</span><span class="token punctuation">,</span><span class="token string">'77.3'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,77.3,'77.3') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0x4D4D4D <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
By default,
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
returns a
binary string. To produce a string in a given character set,
use the optional
<code class="literal">
USING
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66274730"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">121</span><span class="token punctuation">,</span><span class="token number">83</span><span class="token punctuation">,</span><span class="token number">81</span><span class="token punctuation">,</span><span class="token string">'76'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,121,83,81,'76' USING utf8mb4) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MySQL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">77.3</span><span class="token punctuation">,</span><span class="token string">'77.3'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,77.3,'77.3' USING utf8mb4) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MMM <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1292 <span class="token punctuation">|</span> Truncated incorrect INTEGER value: '77.3' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
If
<code class="literal">
USING
</code>
is given and the result string is
illegal for the given character set, a warning is issued.
Also, if strict SQL mode is enabled, the result from
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
becomes
<code class="literal">
NULL
</code>
.
</p>
<p>
If
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary strings
display using hexadecimal notation, depending on the value of
the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
<p>
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
arguments larger than
255 are converted into multiple result bytes. For example,
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR(256)
</code>
</a>
is equivalent to
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR(1,0)
</code>
</a>
, and
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR(256*256)
</code>
</a>
is equivalent to
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR(1,0,0)
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54454773"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">256</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(CHAR(1,0)) <span class="token punctuation">|</span> HEX(CHAR(256)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0100 <span class="token punctuation">|</span> 0100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">256</span><span class="token operator">*</span><span class="token number">256</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(CHAR(1,0,0)) <span class="token punctuation">|</span> HEX(CHAR(256*256)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 010000 <span class="token punctuation">|</span> 010000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_char-length">
</a>
<p>
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203577584">
</a>
<p>
Returns the length of the string
<em class="replaceable">
<code>
str
</code>
</em>
, measured in code points. A
multibyte character counts as a single code point. This means
that, for a string containing two 3-byte characters,
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
returns
<code class="literal">
6
</code>
, whereas
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH()
</code>
</a>
returns
<code class="literal">
2
</code>
, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98571729"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@dolphin</span><span class="token operator">:=</span><span class="token string">'海豚'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span><span class="token variable">@dolphin</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CHAR_LENGTH</span><span class="token punctuation">(</span><span class="token variable">@dolphin</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LENGTH(@dolphin) <span class="token punctuation">|</span> CHAR_LENGTH(@dolphin) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
<code class="literal">
CHAR_LENGTH()
</code>
returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_character-length">
</a>
<p>
<a class="link" href="string-functions.html#function_character-length">
<code class="literal">
CHARACTER_LENGTH(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203559472">
</a>
<p>
<a class="link" href="string-functions.html#function_character-length">
<code class="literal">
CHARACTER_LENGTH()
</code>
</a>
is a synonym
for
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_concat">
</a>
<p>
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT(
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203548672">
</a>
<a class="indexterm" name="idm46045203547600">
</a>
<a class="indexterm" name="idm46045203546528">
</a>
<p>
Returns the string that results from concatenating the
arguments. May have one or more arguments. If all arguments
are nonbinary strings, the result is a nonbinary string. If
the arguments include any binary strings, the result is a
binary string. A numeric argument is converted to its
equivalent nonbinary string form.
</p>
<p>
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
returns
<code class="literal">
NULL
</code>
if any argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38575174"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'My'</span><span class="token punctuation">,</span> <span class="token string">'S'</span><span class="token punctuation">,</span> <span class="token string">'QL'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'My'</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">'QL'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token boolean">NULL</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token number">14.3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'14.3'</span></code></pre>
</div>
<p>
For quoted strings, concatenation can be performed by placing
the strings next to each other:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9883458"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'My'</span> <span class="token string">'S'</span> <span class="token string">'QL'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'MySQL'</span></code></pre>
</div>
<p>
If
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string
results display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_concat-ws">
</a>
<p>
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS(
<em class="replaceable">
<code>
separator
</code>
</em>
,
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203523264">
</a>
<p>
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS()
</code>
</a>
stands for
Concatenate With Separator and is a special form of
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
. The first argument is
the separator for the rest of the arguments. The separator is
added between the strings to be concatenated. The separator
can be a string, as can the rest of the arguments. If the
separator is
<code class="literal">
NULL
</code>
, the result is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61882483"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT_WS</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">'First name'</span><span class="token punctuation">,</span> <span class="token string">'Second name'</span><span class="token punctuation">,</span> <span class="token string">'Last Name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'First name,Second name,Last Name'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT_WS</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">'First name'</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">'Last Name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'First name,Last Name'</span></code></pre>
</div>
<p>
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS()
</code>
</a>
does not skip empty
strings. However, it does skip any
<code class="literal">
NULL
</code>
values after the separator argument.
</p>
</li>
<li class="listitem">
<a name="function_elt">
</a>
<p>
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT(
<em class="replaceable">
<code>
N
</code>
</em>
,
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,
<em class="replaceable">
<code>
str3
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203504304">
</a>
<p>
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT()
</code>
</a>
returns the
<em class="replaceable">
<code>
N
</code>
</em>
th element of the list of strings:
<em class="replaceable">
<code>
str1
</code>
</em>
if
<em class="replaceable">
<code>
N
</code>
</em>
=
<code class="literal">
1
</code>
,
<em class="replaceable">
<code>
str2
</code>
</em>
if
<em class="replaceable">
<code>
N
</code>
</em>
=
<code class="literal">
2
</code>
, and so
on. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
is less than
<code class="literal">
1
</code>
, greater than the number of arguments, or
<code class="literal">
NULL
</code>
.
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT()
</code>
</a>
is the complement of
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD()
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55604232"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ELT</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Aa'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ELT</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Dd'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_export-set">
</a>
<p>
<a class="link" href="string-functions.html#function_export-set">
<code class="literal">
EXPORT_SET(
<em class="replaceable">
<code>
bits
</code>
</em>
,
<em class="replaceable">
<code>
on
</code>
</em>
,
<em class="replaceable">
<code>
off
</code>
</em>
[,
<em class="replaceable">
<code>
separator
</code>
</em>
[,
<em class="replaceable">
<code>
number_of_bits
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045203482096">
</a>
<p>
Returns a string such that for every bit set in the value
<em class="replaceable">
<code>
bits
</code>
</em>
, you get an
<em class="replaceable">
<code>
on
</code>
</em>
string and for every bit not set
in the value, you get an
<em class="replaceable">
<code>
off
</code>
</em>
string. Bits in
<em class="replaceable">
<code>
bits
</code>
</em>
are examined
from right to left (from low-order to high-order bits).
Strings are added to the result from left to right, separated
by the
<em class="replaceable">
<code>
separator
</code>
</em>
string (the
default being the comma character
<code class="literal">
,
</code>
). The
number of bits examined is given by
<em class="replaceable">
<code>
number_of_bits
</code>
</em>
, which has a default
of 64 if not specified.
<em class="replaceable">
<code>
number_of_bits
</code>
</em>
is silently clipped
to 64 if larger than 64. It is treated as an unsigned integer,
so a value of −1 is effectively the same as 64.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3953900"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">EXPORT_SET</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token string">'Y'</span><span class="token punctuation">,</span><span class="token string">'N'</span><span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Y,N,Y,N'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">EXPORT_SET</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span><span class="token string">'1'</span><span class="token punctuation">,</span><span class="token string">'0'</span><span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'0,1,1,0,0,0,0,0,0,0'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_field">
</a>
<p>
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,
<em class="replaceable">
<code>
str3
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203465360">
</a>
<p>
Returns the index (position) of
<em class="replaceable">
<code>
str
</code>
</em>
in the
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,
<em class="replaceable">
<code>
str3
</code>
</em>
,
<code class="literal">
...
</code>
list.
Returns
<code class="literal">
0
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is not found.
</p>
<p>
If all arguments to
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD()
</code>
</a>
are
strings, all arguments are compared as strings. If all
arguments are numbers, they are compared as numbers.
Otherwise, the arguments are compared as double.
</p>
<p>
If
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
,
the return value is
<code class="literal">
0
</code>
because
<code class="literal">
NULL
</code>
fails equality comparison with any
value.
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD()
</code>
</a>
is the
complement of
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT()
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50455261"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FIELD</span><span class="token punctuation">(</span><span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">,</span> <span class="token string">'Ff'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">2</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FIELD</span><span class="token punctuation">(</span><span class="token string">'Gg'</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">,</span> <span class="token string">'Ff'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_find-in-set">
</a>
<p>
<a class="link" href="string-functions.html#function_find-in-set">
<code class="literal">
FIND_IN_SET(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
strlist
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203443168">
</a>
<p>
Returns a value in the range of 1 to
<em class="replaceable">
<code>
N
</code>
</em>
if the string
<em class="replaceable">
<code>
str
</code>
</em>
is in the string list
<em class="replaceable">
<code>
strlist
</code>
</em>
consisting of
<em class="replaceable">
<code>
N
</code>
</em>
substrings. A string list is a
string composed of substrings separated by
<code class="literal">
,
</code>
characters. If the first argument is a
constant string and the second is a column of type
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
, the
<a class="link" href="string-functions.html#function_find-in-set">
<code class="literal">
FIND_IN_SET()
</code>
</a>
function is
optimized to use bit arithmetic. Returns
<code class="literal">
0
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is not in
<em class="replaceable">
<code>
strlist
</code>
</em>
or if
<em class="replaceable">
<code>
strlist
</code>
</em>
is the empty string.
Returns
<code class="literal">
NULL
</code>
if either argument is
<code class="literal">
NULL
</code>
. This function does not work properly
if the first argument contains a comma (
<code class="literal">
,
</code>
)
character.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93561666"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FIND_IN_SET</span><span class="token punctuation">(</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'a,b,c,d'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">2</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_format">
</a>
<p>
<a class="link" href="string-functions.html#function_format">
<code class="literal">
FORMAT(
<em class="replaceable">
<code>
X
</code>
</em>
,
<em class="replaceable">
<code>
D
</code>
</em>
[,
<em class="replaceable">
<code>
locale
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045203422912">
</a>
<p>
Formats the number
<em class="replaceable">
<code>
X
</code>
</em>
to a format
like
<code class="literal">
'#,###,###.##'
</code>
, rounded to
<em class="replaceable">
<code>
D
</code>
</em>
decimal places, and returns the
result as a string. If
<em class="replaceable">
<code>
D
</code>
</em>
is
<code class="literal">
0
</code>
, the result has no decimal point or
fractional part. If
<em class="replaceable">
<code>
X
</code>
</em>
or
<em class="replaceable">
<code>
D
</code>
</em>
is
<code class="literal">
NULL
</code>
, the
function returns
<code class="literal">
NULL
</code>
.
</p>
<p>
The optional third parameter enables a locale to be specified
to be used for the result number's decimal point, thousands
separator, and grouping between separators. Permissible locale
values are the same as the legal values for the
<a class="link" href="server-system-variables.html#sysvar_lc_time_names">
<code class="literal">
lc_time_names
</code>
</a>
system variable
(see
<a class="xref" href="locale-support.html" title="12.16 MySQL Server Locale Support">
Section 12.16, “MySQL Server Locale Support”
</a>
). If the locale is
<code class="literal">
NULL
</code>
or not specified, the default locale
is
<code class="literal">
'en_US'
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81662557"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.123456</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'12,332.1235'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.1</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'12,332.1000'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.2</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'12,332'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.2</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token string">'de_DE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'12.332,20'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_from-base64">
</a>
<p>
<a class="link" href="string-functions.html#function_from-base64">
<code class="literal">
FROM_BASE64(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203401024">
</a>
<p>
Takes a string encoded with the base-64 encoded rules used by
<a class="link" href="string-functions.html#function_to-base64">
<code class="literal">
TO_BASE64()
</code>
</a>
and returns the
decoded result as a binary string. The result is
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
or not a valid base-64 string. See the
description of
<a class="link" href="string-functions.html#function_to-base64">
<code class="literal">
TO_BASE64()
</code>
</a>
for
details about the encoding and decoding rules.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52073285"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">FROM_BASE64</span><span class="token punctuation">(</span><span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'JWJj'</span><span class="token punctuation">,</span> <span class="token string">'abc'</span></code></pre>
</div>
<p>
If
<a class="link" href="string-functions.html#function_from-base64">
<code class="literal">
FROM_BASE64()
</code>
</a>
is invoked
from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary
strings display using hexadecimal notation. You can disable
this behavior by setting the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
to
<code class="literal">
0
</code>
when starting the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client. For more information about
that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_hex">
</a>
<p>
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203378256">
</a>
<p>
For a string argument
<em class="replaceable">
<code>
str
</code>
</em>
,
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
returns a hexadecimal
string representation of
<em class="replaceable">
<code>
str
</code>
</em>
where
each byte of each character in
<em class="replaceable">
<code>
str
</code>
</em>
is converted to two hexadecimal digits. (Multibyte characters
therefore become more than two digits.) The inverse of this
operation is performed by the
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
function.
</p>
<p>
For a numeric argument
<em class="replaceable">
<code>
N
</code>
</em>
,
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
returns a hexadecimal
string representation of the value of
<em class="replaceable">
<code>
N
</code>
</em>
treated as a longlong
(
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
) number. This is
equivalent to
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV(
<em class="replaceable">
<code>
N
</code>
</em>
,10,16)
</code>
</a>
.
The inverse of this operation is performed by
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV(HEX(
<em class="replaceable">
<code>
N
</code>
</em>
),16,10)
</code>
</a>
.
</p>
<p>
For a
<code class="literal">
NULL
</code>
argument, this function returns
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15750629"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> X<span class="token string">'616263'</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token number">616263</span><span class="token punctuation">,</span> <span class="token string">'abc'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CONV</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">16</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'FF'</span><span class="token punctuation">,</span> <span class="token number">255</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_insert">
</a>
<p>
<a class="link" href="string-functions.html#function_insert">
<code class="literal">
INSERT(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
,
<em class="replaceable">
<code>
newstr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203353056">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
, with the
substring beginning at position
<em class="replaceable">
<code>
pos
</code>
</em>
and
<em class="replaceable">
<code>
len
</code>
</em>
characters long replaced by
the string
<em class="replaceable">
<code>
newstr
</code>
</em>
. Returns the
original string if
<em class="replaceable">
<code>
pos
</code>
</em>
is not
within the length of the string. Replaces the rest of the
string from position
<em class="replaceable">
<code>
pos
</code>
</em>
if
<em class="replaceable">
<code>
len
</code>
</em>
is not within the length of the
rest of the string. Returns
<code class="literal">
NULL
</code>
if any
argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73142661"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'QuWhattic'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Quadratic'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'QuWhat'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_instr">
</a>
<p>
<a class="link" href="string-functions.html#function_instr">
<code class="literal">
INSTR(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
substr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203335808">
</a>
<p>
Returns the position of the first occurrence of substring
<em class="replaceable">
<code>
substr
</code>
</em>
in string
<em class="replaceable">
<code>
str
</code>
</em>
. This is the same as the
two-argument form of
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE()
</code>
</a>
,
except that the order of the arguments is reversed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14279875"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INSTR</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token string">'bar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">4</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INSTR</span><span class="token punctuation">(</span><span class="token string">'xbar'</span><span class="token punctuation">,</span> <span class="token string">'foobar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
This function is multibyte safe, and is case-sensitive only if
at least one argument is a binary string. If either argument
is
<code class="literal">
NULL
</code>
, this functions returns
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_lcase">
</a>
<p>
<a class="link" href="string-functions.html#function_lcase">
<code class="literal">
LCASE(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203320704">
</a>
<p>
<a class="link" href="string-functions.html#function_lcase">
<code class="literal">
LCASE()
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
.
</p>
<p>
<code class="literal">
LCASE()
</code>
used in a view is rewritten as
<code class="literal">
LOWER()
</code>
when storing the view's
definition. (Bug #12844279)
</p>
</li>
<li class="listitem">
<a name="function_left">
</a>
<p>
<a class="link" href="string-functions.html#function_left">
<code class="literal">
LEFT(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203308080">
</a>
<p>
Returns the leftmost
<em class="replaceable">
<code>
len
</code>
</em>
characters
from the string
<em class="replaceable">
<code>
str
</code>
</em>
, or
<code class="literal">
NULL
</code>
if any argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35155509"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LEFT</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'fooba'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_length">
</a>
<p>
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203295232">
</a>
<p>
Returns the length of the string
<em class="replaceable">
<code>
str
</code>
</em>
, measured in bytes. A multibyte
character counts as multiple bytes. This means that for a
string containing five 2-byte characters,
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
returns
<code class="literal">
10
</code>
, whereas
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH()
</code>
</a>
returns
<code class="literal">
5
</code>
. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50079136"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span><span class="token string">'text'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">4</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
Length()
</code>
OpenGIS spatial function is
named
<a class="link" href="gis-linestring-property-functions.html#function_st-length">
<code class="literal">
ST_Length()
</code>
</a>
in MySQL.
</p>
</div>
</li>
<li class="listitem">
<a name="function_load-file">
</a>
<p>
<a class="link" href="string-functions.html#function_load-file">
<code class="literal">
LOAD_FILE(
<em class="replaceable">
<code>
file_name
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203276064">
</a>
<a class="indexterm" name="idm46045203274992">
</a>
<p>
Reads the file and returns the file contents as a string. To
use this function, the file must be located on the server
host, you must specify the full path name to the file, and you
must have the
<a class="link" href="privileges-provided.html#priv_file">
<code class="literal">
FILE
</code>
</a>
privilege.
The file must be readable by the server and its size less than
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
bytes. If
the
<a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
<code class="literal">
secure_file_priv
</code>
</a>
system
variable is set to a nonempty directory name, the file to be
loaded must be located in that directory.
</p>
<p>
If the file does not exist or cannot be read because one of
the preceding conditions is not satisfied, the function
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_character_set_filesystem">
<code class="literal">
character_set_filesystem
</code>
</a>
system variable controls interpretation of file names that are
given as literal strings.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83260174"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> t
<span class="token keyword">SET</span> blob_col<span class="token operator">=</span><span class="token function">LOAD_FILE</span><span class="token punctuation">(</span><span class="token string">'/tmp/picture'</span><span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> id<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_locate">
</a>
<p>
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE(
<em class="replaceable">
<code>
substr
</code>
</em>
,
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE(
<em class="replaceable">
<code>
substr
</code>
</em>
,
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203253472">
</a>
<p>
The first syntax returns the position of the first occurrence
of substring
<em class="replaceable">
<code>
substr
</code>
</em>
in string
<em class="replaceable">
<code>
str
</code>
</em>
. The second syntax returns the
position of the first occurrence of substring
<em class="replaceable">
<code>
substr
</code>
</em>
in string
<em class="replaceable">
<code>
str
</code>
</em>
, starting at position
<em class="replaceable">
<code>
pos
</code>
</em>
. Returns
<code class="literal">
0
</code>
if
<em class="replaceable">
<code>
substr
</code>
</em>
is not in
<em class="replaceable">
<code>
str
</code>
</em>
. Returns
<code class="literal">
NULL
</code>
if any argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89130422"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOCATE</span><span class="token punctuation">(</span><span class="token string">'bar'</span><span class="token punctuation">,</span> <span class="token string">'foobarbar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">4</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOCATE</span><span class="token punctuation">(</span><span class="token string">'xbar'</span><span class="token punctuation">,</span> <span class="token string">'foobar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOCATE</span><span class="token punctuation">(</span><span class="token string">'bar'</span><span class="token punctuation">,</span> <span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">7</span></code></pre>
</div>
<p>
This function is multibyte safe, and is case-sensitive only if
at least one argument is a binary string.
</p>
</li>
<li class="listitem">
<a name="function_lower">
</a>
<p>
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203236064">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with all
characters changed to lowercase according to the current
character set mapping, or
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
. The
default character set is
<code class="literal">
utf8mb4
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53318176"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token string">'QUADRATICALLY'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'quadratically'</span></code></pre>
</div>
<p>
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
(and
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
) are ineffective when
applied to binary strings
(
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
,
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
). To perform lettercase
conversion of a binary string, first convert it to a nonbinary
string using a character set appropriate for the data stored
in the string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41130150"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@str</span> <span class="token operator">=</span> <span class="token datatype">BINARY</span> <span class="token string">'New York'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token variable">@str</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token variable">@str</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LOWER(@str) <span class="token punctuation">|</span> LOWER(CONVERT(@str USING utf8mb4)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> New York <span class="token punctuation">|</span> new york <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For collations of Unicode character sets,
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
and
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
work according to the
Unicode Collation Algorithm (UCA) version in the collation
name, if there is one, and UCA 4.0.0 if no version is
specified. For example,
<code class="literal">
utf8mb4_0900_ai_ci
</code>
and
<code class="literal">
utf8mb3_unicode_520_ci
</code>
work according
to UCA 9.0.0 and 5.2.0, respectively, whereas
<code class="literal">
utf8mb3_unicode_ci
</code>
works according to UCA
4.0.0. See
<a class="xref" href="charset-unicode-sets.html" title="12.10.1 Unicode Character Sets">
Section 12.10.1, “Unicode Character Sets”
</a>
.
</p>
<p>
This function is multibyte safe.
</p>
<p>
<code class="literal">
LCASE()
</code>
used within views is rewritten as
<code class="literal">
LOWER()
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_lpad">
</a>
<p>
<a class="link" href="string-functions.html#function_lpad">
<code class="literal">
LPAD(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
,
<em class="replaceable">
<code>
padstr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203204720">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
, left-padded
with the string
<em class="replaceable">
<code>
padstr
</code>
</em>
to a length
of
<em class="replaceable">
<code>
len
</code>
</em>
characters. If
<em class="replaceable">
<code>
str
</code>
</em>
is longer than
<em class="replaceable">
<code>
len
</code>
</em>
, the return value is shortened
to
<em class="replaceable">
<code>
len
</code>
</em>
characters.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20696615"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'??'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'??hi'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'??'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'h'</span></code></pre>
</div>
<p>
Returns
<code class="literal">
NULL
</code>
if any of its arguments are
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_ltrim">
</a>
<p>
<a class="link" href="string-functions.html#function_ltrim">
<code class="literal">
LTRIM(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203189312">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with leading
space characters removed. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90604493"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LTRIM</span><span class="token punctuation">(</span><span class="token string">' barbar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'barbar'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_make-set">
</a>
<p>
<a class="link" href="string-functions.html#function_make-set">
<code class="literal">
MAKE_SET(
<em class="replaceable">
<code>
bits
</code>
</em>
,
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203175552">
</a>
<p>
Returns a set value (a string containing substrings separated
by
<code class="literal">
,
</code>
characters) consisting of the strings
that have the corresponding bit in
<em class="replaceable">
<code>
bits
</code>
</em>
set.
<em class="replaceable">
<code>
str1
</code>
</em>
corresponds to bit 0,
<em class="replaceable">
<code>
str2
</code>
</em>
to bit 1, and so on.
<code class="literal">
NULL
</code>
values in
<em class="replaceable">
<code>
str1
</code>
</em>
,
<em class="replaceable">
<code>
str2
</code>
</em>
,
<code class="literal">
...
</code>
are
not appended to the result.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96057680"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">,</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'a'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span> <span class="token operator">|</span> <span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'hello'</span><span class="token punctuation">,</span><span class="token string">'nice'</span><span class="token punctuation">,</span><span class="token string">'world'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'hello,world'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span> <span class="token operator">|</span> <span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'hello'</span><span class="token punctuation">,</span><span class="token string">'nice'</span><span class="token punctuation">,</span><span class="token boolean">NULL</span><span class="token punctuation">,</span><span class="token string">'world'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'hello'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">,</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">''</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_mid">
</a>
<p>
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
FOR
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203151392">
</a>
<p>
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_oct">
</a>
<p>
<a class="link" href="string-functions.html#function_oct">
<code class="literal">
OCT(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203138752">
</a>
<p>
Returns a string representation of the octal value of
<em class="replaceable">
<code>
N
</code>
</em>
, where
<em class="replaceable">
<code>
N
</code>
</em>
is a longlong
(
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
) number. This is
equivalent to
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV(
<em class="replaceable">
<code>
N
</code>
</em>
,10,8)
</code>
</a>
.
Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43606228"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">OCT</span><span class="token punctuation">(</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'14'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_octet-length">
</a>
<p>
<a class="link" href="string-functions.html#function_octet-length">
<code class="literal">
OCTET_LENGTH(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203123072">
</a>
<p>
<a class="link" href="string-functions.html#function_octet-length">
<code class="literal">
OCTET_LENGTH()
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_ord">
</a>
<p>
<a class="link" href="string-functions.html#function_ord">
<code class="literal">
ORD(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203112736">
</a>
<p>
If the leftmost character of the string
<em class="replaceable">
<code>
str
</code>
</em>
is a multibyte character,
returns the code for that character, calculated from the
numeric values of its constituent bytes using this formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-clike"><div class="docs-select-all right" id="sa91020685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"> <span class="token punctuation">(</span>1st byte code<span class="token punctuation">)</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>2nd byte code <span class="token operator">*</span> <span class="token number">256</span><span class="token punctuation">)</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>3rd byte code <span class="token operator">*</span> <span class="token number">256</span><span class="token operator">^</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
If the leftmost character is not a multibyte character,
<a class="link" href="string-functions.html#function_ord">
<code class="literal">
ORD()
</code>
</a>
returns the same value as
the
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII()
</code>
</a>
function. The
function returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14073142"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ORD</span><span class="token punctuation">(</span><span class="token string">'2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">50</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_position">
</a>
<p>
<a class="link" href="string-functions.html#function_position">
<code class="literal">
POSITION(
<em class="replaceable">
<code>
substr
</code>
</em>
IN
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203095712">
</a>
<p>
<a class="link" href="string-functions.html#function_position">
<code class="literal">
POSITION(
<em class="replaceable">
<code>
substr
</code>
</em>
IN
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE(
<em class="replaceable">
<code>
substr
</code>
</em>
,
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_quote">
</a>
<p>
<a class="link" href="string-functions.html#function_quote">
<code class="literal">
QUOTE(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203083744">
</a>
<p>
Quotes a string to produce a result that can be used as a
properly escaped data value in an SQL statement. The string is
returned enclosed by single quotation marks and with each
instance of backslash (
<code class="literal">
\
</code>
), single quote
(
<code class="literal">
'
</code>
), ASCII
<code class="literal">
NUL
</code>
, and
Control+Z preceded by a backslash. If the argument is
<code class="literal">
NULL
</code>
, the return value is the word
<span class="quote">
“
<span class="quote">
NULL
</span>
”
</span>
without enclosing single quotation marks.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39237508"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">QUOTE</span><span class="token punctuation">(</span><span class="token string">'Don\'t!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Don\'t!'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">QUOTE</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token boolean">NULL</span></code></pre>
</div>
<a class="indexterm" name="idm46045203074096">
</a>
<p>
For comparison, see the quoting rules for literal strings and
within the C API in
<a class="xref" href="string-literals.html" title="11.1.1 String Literals">
Section 11.1.1, “String Literals”
</a>
, and
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-escape-string-quote.html" target="_top">
mysql_real_escape_string_quote()
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_repeat">
</a>
<p>
<a class="link" href="string-functions.html#function_repeat">
<code class="literal">
REPEAT(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
count
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203065808">
</a>
<p>
Returns a string consisting of the string
<em class="replaceable">
<code>
str
</code>
</em>
repeated
<em class="replaceable">
<code>
count
</code>
</em>
times. If
<em class="replaceable">
<code>
count
</code>
</em>
is less than 1, returns an
empty string. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
or
<em class="replaceable">
<code>
count
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97835741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">REPEAT</span><span class="token punctuation">(</span><span class="token string">'MySQL'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'MySQLMySQLMySQL'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_replace">
</a>
<p>
<a class="link" href="string-functions.html#function_replace">
<code class="literal">
REPLACE(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
from_str
</code>
</em>
,
<em class="replaceable">
<code>
to_str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203051184">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with all
occurrences of the string
<em class="replaceable">
<code>
from_str
</code>
</em>
replaced by the string
<em class="replaceable">
<code>
to_str
</code>
</em>
.
<a class="link" href="string-functions.html#function_replace">
<code class="literal">
REPLACE()
</code>
</a>
performs a
case-sensitive match when searching for
<em class="replaceable">
<code>
from_str
</code>
</em>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88461084"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">REPLACE</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'w'</span><span class="token punctuation">,</span> <span class="token string">'Ww'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'WwWwWw.mysql.com'</span></code></pre>
</div>
<p>
This function is multibyte safe. It returns
<code class="literal">
NULL
</code>
if any of its arguments are
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_reverse">
</a>
<p>
<a class="link" href="string-functions.html#function_reverse">
<code class="literal">
REVERSE(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203036048">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with the
order of the characters reversed, or
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70488247"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">REVERSE</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'cba'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_right">
</a>
<p>
<a class="link" href="string-functions.html#function_right">
<code class="literal">
RIGHT(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203022816">
</a>
<p>
Returns the rightmost
<em class="replaceable">
<code>
len
</code>
</em>
characters from the string
<em class="replaceable">
<code>
str
</code>
</em>
, or
<code class="literal">
NULL
</code>
if any argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55212818"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">RIGHT</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'rbar'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_rpad">
</a>
<p>
<a class="link" href="string-functions.html#function_rpad">
<code class="literal">
RPAD(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
,
<em class="replaceable">
<code>
padstr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045203009232">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
,
right-padded with the string
<em class="replaceable">
<code>
padstr
</code>
</em>
to a length of
<em class="replaceable">
<code>
len
</code>
</em>
characters. If
<em class="replaceable">
<code>
str
</code>
</em>
is longer than
<em class="replaceable">
<code>
len
</code>
</em>
, the return value is shortened
to
<em class="replaceable">
<code>
len
</code>
</em>
characters. If
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
padstr
</code>
</em>
, or
<em class="replaceable">
<code>
len
</code>
</em>
is
<code class="literal">
NULL
</code>
, the
function returns
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69862993"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">RPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token string">'?'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'hi???'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">RPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'?'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'h'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
</li>
<li class="listitem">
<a name="function_rtrim">
</a>
<p>
<a class="link" href="string-functions.html#function_rtrim">
<code class="literal">
RTRIM(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202992496">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with
trailing space characters removed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61458262"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">RTRIM</span><span class="token punctuation">(</span><span class="token string">'barbar '</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'barbar'</span></code></pre>
</div>
<p>
This function is multibyte safe, and returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_soundex">
</a>
<p>
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202979616">
</a>
<p>
Returns a soundex string from
<em class="replaceable">
<code>
str
</code>
</em>
,
or
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
. Two strings that sound almost the
same should have identical soundex strings. A standard soundex
string is four characters long, but the
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX()
</code>
</a>
function returns an
arbitrarily long string. You can use
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING()
</code>
</a>
on the result to
get a standard soundex string. All nonalphabetic characters in
<em class="replaceable">
<code>
str
</code>
</em>
are ignored. All international
alphabetic characters outside the A-Z range are treated as
vowels.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When using
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX()
</code>
</a>
, you
should be aware of the following limitations:
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
This function, as currently implemented, is intended to
work well with strings that are in the English language
only. Strings in other languages may not produce reliable
results.
</p>
</li>
<li class="listitem">
<p>
This function is not guaranteed to provide consistent
results with strings that use multibyte character sets,
including
<code class="literal">
utf-8
</code>
. See Bug #22638 for
more information.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63223011"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SOUNDEX</span><span class="token punctuation">(</span><span class="token string">'Hello'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'H400'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SOUNDEX</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'Q36324'</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This function implements the original Soundex algorithm, not
the more popular enhanced version (also described by D.
Knuth). The difference is that original version discards
vowels first and duplicates second, whereas the enhanced
version discards duplicates first and vowels second.
</p>
</div>
</li>
<li class="listitem">
<a name="operator_sounds-like">
</a>
<p>
<a class="link" href="string-functions.html#operator_sounds-like">
<code class="literal">
<em class="replaceable">
<code>
expr1
</code>
</em>
SOUNDS LIKE
<em class="replaceable">
<code>
expr2
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045202956560">
</a>
<p>
This is the same as
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX(
<em class="replaceable">
<code>
expr1
</code>
</em>
)
= SOUNDEX(
<em class="replaceable">
<code>
expr2
</code>
</em>
)
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_space">
</a>
<p>
<a class="link" href="string-functions.html#function_space">
<code class="literal">
SPACE(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202946544">
</a>
<p>
Returns a string consisting of
<em class="replaceable">
<code>
N
</code>
</em>
space characters, or
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76532257"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SPACE</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">' '</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_substr">
</a>
<p>
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
FOR
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202926912">
</a>
<p>
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR()
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_substring">
</a>
<p>
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
pos
</code>
</em>
,
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING(
<em class="replaceable">
<code>
str
</code>
</em>
FROM
<em class="replaceable">
<code>
pos
</code>
</em>
FOR
<em class="replaceable">
<code>
len
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202909328">
</a>
<p>
The forms without a
<em class="replaceable">
<code>
len
</code>
</em>
argument
return a substring from string
<em class="replaceable">
<code>
str
</code>
</em>
starting at position
<em class="replaceable">
<code>
pos
</code>
</em>
. The forms
with a
<em class="replaceable">
<code>
len
</code>
</em>
argument return a
substring
<em class="replaceable">
<code>
len
</code>
</em>
characters long from
string
<em class="replaceable">
<code>
str
</code>
</em>
, starting at position
<em class="replaceable">
<code>
pos
</code>
</em>
. The forms that use
<code class="literal">
FROM
</code>
are standard SQL syntax. It is also
possible to use a negative value for
<em class="replaceable">
<code>
pos
</code>
</em>
. In this case, the beginning of
the substring is
<em class="replaceable">
<code>
pos
</code>
</em>
characters
from the end of the string, rather than the beginning. A
negative value may be used for
<em class="replaceable">
<code>
pos
</code>
</em>
in any of the forms of this function. A value of 0 for
<em class="replaceable">
<code>
pos
</code>
</em>
returns an empty string.
</p>
<p>
For all forms of
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING()
</code>
</a>
,
the position of the first character in the string from which
the substring is to be extracted is reckoned as
<code class="literal">
1
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89214630"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'ratically'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span> <span class="token keyword">FROM</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'barbar'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'ratica'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'ila'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'aki'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span> <span class="token keyword">FROM</span> <span class="token operator">-</span><span class="token number">4</span> <span class="token keyword">FOR</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'ki'</span></code></pre>
</div>
<p>
This function is multibyte safe. It returns
<code class="literal">
NULL
</code>
if any of its arguments are
<code class="literal">
NULL
</code>
.
</p>
<p>
If
<em class="replaceable">
<code>
len
</code>
</em>
is less than 1, the result
is the empty string.
</p>
</li>
<li class="listitem">
<a name="function_substring-index">
</a>
<p>
<a class="link" href="string-functions.html#function_substring-index">
<code class="literal">
SUBSTRING_INDEX(
<em class="replaceable">
<code>
str
</code>
</em>
,
<em class="replaceable">
<code>
delim
</code>
</em>
,
<em class="replaceable">
<code>
count
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202883312">
</a>
<p>
Returns the substring from string
<em class="replaceable">
<code>
str
</code>
</em>
before
<em class="replaceable">
<code>
count
</code>
</em>
occurrences of the delimiter
<em class="replaceable">
<code>
delim
</code>
</em>
. If
<em class="replaceable">
<code>
count
</code>
</em>
is positive, everything to
the left of the final delimiter (counting from the left) is
returned. If
<em class="replaceable">
<code>
count
</code>
</em>
is negative,
everything to the right of the final delimiter (counting from
the right) is returned.
<a class="link" href="string-functions.html#function_substring-index">
<code class="literal">
SUBSTRING_INDEX()
</code>
</a>
performs a
case-sensitive match when searching for
<em class="replaceable">
<code>
delim
</code>
</em>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50761303"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING_INDEX</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'.'</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'www.mysql'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING_INDEX</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'.'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'mysql.com'</span></code></pre>
</div>
<p>
This function is multibyte safe.
</p>
<p>
<code class="literal">
SUBSTRING_INDEX()
</code>
returns
<code class="literal">
NULL
</code>
if any of its arguments are
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_to-base64">
</a>
<p>
<a class="link" href="string-functions.html#function_to-base64">
<code class="literal">
TO_BASE64(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202865168">
</a>
<p>
Converts the string argument to base-64 encoded form and
returns the result as a character string with the connection
character set and collation. If the argument is not a string,
it is converted to a string before conversion takes place. The
result is
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
. Base-64 encoded strings can be
decoded using the
<a class="link" href="string-functions.html#function_from-base64">
<code class="literal">
FROM_BASE64()
</code>
</a>
function.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70610820"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">FROM_BASE64</span><span class="token punctuation">(</span><span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'JWJj'</span><span class="token punctuation">,</span> <span class="token string">'abc'</span></code></pre>
</div>
<p>
Different base-64 encoding schemes exist. These are the
encoding and decoding rules used by
<a class="link" href="string-functions.html#function_to-base64">
<code class="literal">
TO_BASE64()
</code>
</a>
and
<a class="link" href="string-functions.html#function_from-base64">
<code class="literal">
FROM_BASE64()
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The encoding for alphabet value 62 is
<code class="literal">
'+'
</code>
.
</p>
</li>
<li class="listitem">
<p>
The encoding for alphabet value 63 is
<code class="literal">
'/'
</code>
.
</p>
</li>
<li class="listitem">
<p>
Encoded output consists of groups of 4 printable
characters. Each 3 bytes of the input data are encoded
using 4 characters. If the last group is incomplete, it is
padded with
<code class="literal">
'='
</code>
characters to a length
of 4.
</p>
</li>
<li class="listitem">
<p>
A newline is added after each 76 characters of encoded
output to divide long output into multiple lines.
</p>
</li>
<li class="listitem">
<p>
Decoding recognizes and ignores newline, carriage return,
tab, and space.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<a name="function_trim">
</a>
<p>
<a class="link" href="string-functions.html#function_trim">
<code class="literal">
TRIM([{BOTH | LEADING | TRAILING}
[
<em class="replaceable">
<code>
remstr
</code>
</em>
] FROM]
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
,
<a class="link" href="string-functions.html#function_trim">
<code class="literal">
TRIM([
<em class="replaceable">
<code>
remstr
</code>
</em>
FROM]
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202839296">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with all
<em class="replaceable">
<code>
remstr
</code>
</em>
prefixes or suffixes
removed. If none of the specifiers
<code class="literal">
BOTH
</code>
,
<code class="literal">
LEADING
</code>
, or
<code class="literal">
TRAILING
</code>
is
given,
<code class="literal">
BOTH
</code>
is assumed.
<em class="replaceable">
<code>
remstr
</code>
</em>
is optional and, if not
specified, spaces are removed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86455714"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token string">' bar '</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'bar'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">LEADING</span> <span class="token string">'x'</span> <span class="token keyword">FROM</span> <span class="token string">'xxxbarxxx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'barxxx'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">BOTH</span> <span class="token string">'x'</span> <span class="token keyword">FROM</span> <span class="token string">'xxxbarxxx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'bar'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">TRAILING</span> <span class="token string">'xyz'</span> <span class="token keyword">FROM</span> <span class="token string">'barxxyz'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'barx'</span></code></pre>
</div>
<p>
This function is multibyte safe. It returns
<code class="literal">
NULL
</code>
if any of its arguments are
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_ucase">
</a>
<p>
<a class="link" href="string-functions.html#function_ucase">
<code class="literal">
UCASE(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202820608">
</a>
<p>
<a class="link" href="string-functions.html#function_ucase">
<code class="literal">
UCASE()
</code>
</a>
is a synonym for
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
.
</p>
<p>
<code class="literal">
UCASE()
</code>
used within views is rewritten as
<code class="literal">
UPPER()
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_unhex">
</a>
<p>
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202808416">
</a>
<p>
For a string argument
<em class="replaceable">
<code>
str
</code>
</em>
,
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
interprets each pair of characters in the argument as a
hexadecimal number and converts it to the byte represented by
the number. The return value is a binary string.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8810038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'4D7953514C'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> X<span class="token string">'4D7953514C'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'string'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'string'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'1267'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'1267'</span></code></pre>
</div>
<p>
The characters in the argument string must be legal
hexadecimal digits:
<code class="literal">
'0'
</code>
..
<code class="literal">
'9'
</code>
,
<code class="literal">
'A'
</code>
..
<code class="literal">
'F'
</code>
,
<code class="literal">
'a'
</code>
..
<code class="literal">
'f'
</code>
. If the argument contains any
nonhexadecimal digits, or is itself
<code class="literal">
NULL
</code>
,
the result is
<code class="literal">
NULL
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21034611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'GG'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> UNHEX('GG') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> UNHEX(NULL) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
A
<code class="literal">
NULL
</code>
result can also occur if the
argument to
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
is a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
column, because values
are padded with
<code class="literal">
0x00
</code>
bytes when stored but
those bytes are not stripped on retrieval. For example,
<code class="literal">
'41'
</code>
is stored into a
<code class="literal">
CHAR(3)
</code>
column as
<code class="literal">
'41 '
</code>
and retrieved as
<code class="literal">
'41'
</code>
(with the trailing pad space
stripped), so
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
for the
column value returns
<code class="literal">
X'41'
</code>
. By contrast,
<code class="literal">
'41'
</code>
is stored into a
<code class="literal">
BINARY(3)
</code>
column as
<code class="literal">
'41\0'
</code>
and retrieved as
<code class="literal">
'41\0'
</code>
(with the trailing pad
<code class="literal">
0x00
</code>
byte not stripped).
<code class="literal">
'\0'
</code>
is not a legal hexadecimal digit, so
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
for the column value
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
For a numeric argument
<em class="replaceable">
<code>
N
</code>
</em>
, the
inverse of
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
is not performed by
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
.
Use
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV(HEX(
<em class="replaceable">
<code>
N
</code>
</em>
),16,10)
</code>
</a>
instead. See the description of
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
.
</p>
<p>
If
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary strings
display using hexadecimal notation, depending on the value of
the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_upper">
</a>
<p>
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER(
<em class="replaceable">
<code>
str
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045202757776">
</a>
<p>
Returns the string
<em class="replaceable">
<code>
str
</code>
</em>
with all
characters changed to uppercase according to the current
character set mapping, or
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
str
</code>
</em>
is
<code class="literal">
NULL
</code>
. The
default character set is
<code class="literal">
utf8mb4
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66791064"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UPPER</span><span class="token punctuation">(</span><span class="token string">'Hej'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'HEJ'</span></code></pre>
</div>
<p>
See the description of
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
for information that also applies to
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
. This included
information about how to perform lettercase conversion of
binary strings (
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
,
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
) for which these functions
are ineffective, and information about case folding for
Unicode character sets.
</p>
<p>
This function is multibyte safe.
</p>
<p>
<code class="literal">
UCASE()
</code>
used within views is rewritten as
<code class="literal">
UPPER()
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_weight-string">
</a>
<p>
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING(
<em class="replaceable">
<code>
str
</code>
</em>
[AS {CHAR|BINARY}(
<em class="replaceable">
<code>
N
</code>
</em>
)]
[
<em class="replaceable">
<code>
flags
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045202735056">
</a>
<p>
This function returns the weight string for the input string.
The return value is a binary string that represents the
comparison and sorting value of the string, or
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
. It has these properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING(
<em class="replaceable">
<code>
str1
</code>
</em>
)
</code>
</a>
=
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING(
<em class="replaceable">
<code>
str2
</code>
</em>
)
</code>
</a>
,
then
<code class="literal">
<em class="replaceable">
<code>
str1
</code>
</em>
=
<em class="replaceable">
<code>
str2
</code>
</em>
</code>
(
<em class="replaceable">
<code>
str1
</code>
</em>
and
<em class="replaceable">
<code>
str2
</code>
</em>
are considered equal)
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING(
<em class="replaceable">
<code>
str1
</code>
</em>
)
</code>
</a>
<
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING(
<em class="replaceable">
<code>
str2
</code>
</em>
)
</code>
</a>
,
then
<code class="literal">
<em class="replaceable">
<code>
str1
</code>
</em>
<
<em class="replaceable">
<code>
str2
</code>
</em>
</code>
(
<em class="replaceable">
<code>
str1
</code>
</em>
sorts before
<em class="replaceable">
<code>
str2
</code>
</em>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
is a debugging
function intended for internal use. Its behavior can change
without notice between MySQL versions. It can be used for
testing and debugging of collations, especially if you are
adding a new collation. See
<a class="xref" href="adding-collation.html" title="12.14 Adding a Collation to a Character Set">
Section 12.14, “Adding a Collation to a Character Set”
</a>
.
</p>
<p>
This list briefly summarizes the arguments. More details are
given in the discussion following the list.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
str
</code>
</em>
: The input string
expression.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AS
</code>
clause: Optional; cast the input
string to a given type and length.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
flags
</code>
</em>
: Optional; unused.
</p>
</li>
</ul>
</div>
<p>
The input string,
<em class="replaceable">
<code>
str
</code>
</em>
, is a string
expression. If the input is a nonbinary (character) string
such as a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
value, the return value
contains the collation weights for the string. If the input is
a binary (byte) string such as a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
value, the return value is
the same as the input (the weight for each byte in a binary
string is the byte value). If the input is
<code class="literal">
NULL
</code>
,
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54113437"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> _utf8mb4 <span class="token string">'AB'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> AB <span class="token punctuation">|</span> 4142 <span class="token punctuation">|</span> 1C471C60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73594578"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> _utf8mb4 <span class="token string">'ab'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ab <span class="token punctuation">|</span> 6162 <span class="token punctuation">|</span> 1C471C60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17311837"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'AB'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> AB <span class="token punctuation">|</span> 4142 <span class="token punctuation">|</span> 4142 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35660432"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ab <span class="token punctuation">|</span> 6162 <span class="token punctuation">|</span> 6162 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The preceding examples use
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
to display the
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
result. Because
the result is a binary value,
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
can be especially useful
when the result contains nonprinting values, to display it in
printable form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68981741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span>X<span class="token string">'C39F'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_czech_ci<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0FEA0FEA <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For non-
<code class="literal">
NULL
</code>
return values, the data type
of the value is
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
if
its length is within the maximum length for
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, otherwise the data
type is
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
.
</p>
<p>
The
<code class="literal">
AS
</code>
clause may be given to cast the
input string to a nonbinary or binary string and to force it
to a given length:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
AS CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
casts the string to a nonbinary string and pads it on the
right with spaces to a length of
<em class="replaceable">
<code>
N
</code>
</em>
characters.
<em class="replaceable">
<code>
N
</code>
</em>
must be at least 1. If
<em class="replaceable">
<code>
N
</code>
</em>
is less than the length of
the input string, the string is truncated to
<em class="replaceable">
<code>
N
</code>
</em>
characters. No warning occurs
for truncation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AS BINARY(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
is similar but casts the string to a binary string,
<em class="replaceable">
<code>
N
</code>
</em>
is measured in bytes (not
characters), and padding uses
<code class="literal">
0x00
</code>
bytes (not spaces).
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1567566"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'latin1'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING('ab' AS CHAR(4))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 41422020 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING('ab' AS CHAR(4))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1C471C60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1913234"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING('ab' AS BINARY(4))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 61620000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The
<em class="replaceable">
<code>
flags
</code>
</em>
clause currently is
unused.
</p>
<p>
If
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
is invoked
from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary
strings display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-configuring-consistency-guarantees.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-configuring-consistency-guarantees">
</a>
20.5.3.2 Configuring Transaction Consistency Guarantees
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133339792">
</a>
<p>
Although the
<a class="xref" href="group-replication-understanding-consistency-guarantees.html#group-replication-synchronization-points" title="Transaction Synchronization Points">
Transaction Synchronization Points
</a>
section explains that conceptually there are two synchronization
points from which you can choose: on read or on write, these
terms were a simplification and the terms used in Group
Replication are:
<span class="emphasis">
<em>
before
</em>
</span>
and
<span class="emphasis">
<em>
after
</em>
</span>
transaction execution. The
consistency level can have different effects on read-only and
read/write transactions processed by the group as demonstrated
in this section.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="group-replication-configuring-consistency-guarantees.html#group-replication-choose-consistency-level" title="How to Choose a Consistency Level">
How to Choose a Consistency Level
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-configuring-consistency-guarantees.html#group-replication-consistency-level-impacts" title="Impacts of Consistency Levels">
Impacts of Consistency Levels
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-configuring-consistency-guarantees.html#group-replication-consistency-level-impact-election" title="Impact of Consistency on Primary Election">
Impact of Consistency on Primary Election
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-configuring-consistency-guarantees.html#group-replication-nonblocking" title="Permitted Queries Under Consistency Rules">
Permitted Queries Under Consistency Rules
</a>
</p>
</li>
</ul>
</div>
<p>
The following list shows the possible consistency levels that
you can configure in Group Replication using the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
variable, in order of increasing transaction consistency
guarantee:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
EVENTUAL
</code>
</p>
<p>
Neither read-only nor read/write transactions wait for
preceding transactions to be applied before executing. This
was the behavior of Group Replication before the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
variable was added. A read/write transaction does not wait
for other members to apply a transaction. This means that a
transaction could be externalized on one member before the
others. This also means that in the event of a primary
failover, the new primary can accept new read-only and
read/write transactions before the previous primary
transactions are all applied. Read-only transactions could
result in outdated values, read/write transactions could
result in a rollback due to conflicts.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
</p>
<p>
New read-only or read/write transactions with a newly
elected primary that is applying a backlog from the old
primary are not applied until any backlog has been applied.
This ensures that when a primary failover happens,
intentionally or not, clients always see the latest value on
the primary. This guarantees consistency, but means that
clients must be able to handle the delay in the event that a
backlog is being applied. Usually this delay should be
minimal, but it does depend on the size of the backlog.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BEFORE
</code>
</p>
<p>
A read/write transaction waits for all preceding
transactions to complete before being applied. A read-only
transaction waits for all preceding transactions to complete
before being executed. This ensures that this transaction
reads the latest value by only affecting the latency of the
transaction. This reduces the overhead of synchronization on
every read/write transaction, by ensuring synchronization is
used only on read-only transactions. This consistency level
also includes the consistency guarantees provided by
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AFTER
</code>
</p>
<p>
A read/write transaction waits until its changes have been
applied to all of the other members. This value has no
effect on read-only transactions. This mode ensures that
when a transaction is committed on the local member, any
subsequent transaction reads the written value or a more
recent value on any group member. Use this mode with a group
that is used for predominantly read-only operations to
ensure that applied read/write transactions are applied
everywhere once they commit. This could be used by your
application to ensure that subsequent reads fetch the latest
data which includes the latest writes. This reduces the
overhead of synchronization on every read-only transaction,
by ensuring synchronization is used only on read/write
transactions. This consistency level also includes the
consistency guarantees provided by
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BEFORE_AND_AFTER
</code>
</p>
<p>
A read/write transaction waits for 1) all preceding
transactions to complete before being applied and 2) until
its changes have been applied on other members. A read-only
transaction waits for all preceding transactions to complete
before execution takes place. This consistency level also
includes the consistency guarantees provided by
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
BEFORE
</code>
and
<code class="literal">
BEFORE_AND_AFTER
</code>
consistency levels can be
used on both read-only and read/write transactions. The
<code class="literal">
AFTER
</code>
consistency level has no impact on
read-only transactions, because they do not generate changes.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-choose-consistency-level">
</a>
How to Choose a Consistency Level
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133310032">
</a>
<p>
The different consistency levels provide flexibility to both
DBAs, who can use them to set up their infrastructure; and to
developers who can use the consistency level that best suits
their application's requirements. The following scenarios show
how to choose a consistency guarantee level based on how you
use your group:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 1
</em>
</span>
: You want to balance reads
without being concerned about stale reads, and group write
operations are considerably fewer than group read
operations. In this case, you should choose
<code class="literal">
AFTER
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 2
</em>
</span>
: For a data set that
applies many writes, you want to perform occasional reads
without concerns about reading stale data. In this case,
you should choose
<code class="literal">
BEFORE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 3
</em>
</span>
: You want specific
transactions to read only up-to-date data from the group,
so that whenever sensitive data such as credentials for a
file is updated, reads always use the most recent value.
In this case, you should choose
<code class="literal">
BEFORE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 4
</em>
</span>
: For a group that has
predominantly read-only data, you want read/write
transactions to be applied everywhere once they commit, so
that subsequent reads are done on data that includes your
latest writes and you do not incur the cost of
synchronization for every read-only transaction, but only
for read/write transactions. In this case, you should
choose
<code class="literal">
AFTER
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 5
</em>
</span>
: For a group that works
predominantly with read-only data, you want read/write
transactions to read up-to-date data from the group and to
be applied everywhere once they commit, so that subsequent
reads are performed on data that includes the latest write
and you do not incur the cost of synchronization for every
read-only transaction, but only for read/write
transactions. In this case, you should choose
<code class="literal">
BEFORE_AND_AFTER
</code>
.
</p>
</li>
</ul>
</div>
<p>
You can choose the scope for which the consistency level is
enforced by setting
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
with session or global scope. This is important because
consistency levels can have a negative impact on group
performance they apply globally.
</p>
<p>
To enforce the consistency level for the current session, use
session scope, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31323036"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">SET</span> <span class="token variable">@@SESSION.group_replication_consistency</span><span class="token operator">=</span> <span class="token string">'BEFORE'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To enforce the consistency level for all sessions, use global
scope, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97900485"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">SET</span> <span class="token variable">@@GLOBAL.group_replication_consistency</span><span class="token operator">=</span> <span class="token string">'BEFORE'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The possibility of setting the consistency level on specific
sessions enables you to take advantage of scenarios such as
those listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 6
</em>
</span>
: A given system handles
several instructions that do not require a strong
consistency level, but one kind of instruction does
require strong consistency: managing access permissions to
documents;. In this scenario, the system changes access
permissions and it wants to be sure that all clients see
the correct permission. You only need to
<code class="literal">
SET
@@SESSION.group_replication_consistency=
‘AFTER’
</code>
, on those instructions and leave the
other instructions to run with
<code class="literal">
EVENTUAL
</code>
set at the global scope.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Scenario 7
</em>
</span>
: On the same system as
described in Scenario 6, a command that performs analytics
needs to be executed daily, using the most up-to-date
data. To achieve this, you need only run the SQL statement
<code class="literal">
SET @@SESSION.group_replication_consistency=
‘BEFORE’
</code>
prior to executing the command.
</p>
</li>
</ul>
</div>
<p>
In sum, you do not need to run all transactions with the same
specific consistency level, especially if only some
transactions actually require it.
</p>
<p>
You should be aware that all read/write transactions are
always ordered in Group Replication, so even when you set the
consistency level to
<code class="literal">
AFTER
</code>
for the current
session, this transaction waits until its changes are applied
on all members, which means waiting for this and all preceding
transactions that could be in the secondaries' queues. In
other words, the consistency level
<code class="literal">
AFTER
</code>
waits for everything up to and including this transaction.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-consistency-level-impacts">
</a>
Impacts of Consistency Levels
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133279712">
</a>
<p>
Another way to classify the consistency levels is in terms of
impact on the group, that is, the repercussions that the
consistency levels have on the other members.
</p>
<p>
The
<code class="literal">
BEFORE
</code>
consistency level, apart from
being ordered on the transaction stream, only impacts on the
local member. That is, it does not require coordination with
the other members and does not have repercussions on their
transactions. In other words,
<code class="literal">
BEFORE
</code>
only
impacts the transactions on which it is used.
</p>
<p>
The
<code class="literal">
AFTER
</code>
and
<code class="literal">
BEFORE_AND_AFTER
</code>
consistency levels do have
side-effects on concurrent transactions executed on other
members. These consistency levels make the other members
transactions wait if transactions with the
<code class="literal">
EVENTUAL
</code>
consistency level start while a
transaction with
<code class="literal">
AFTER
</code>
or
<code class="literal">
BEFORE_AND_AFTER
</code>
is executing. The other
members wait until the
<code class="literal">
AFTER
</code>
transaction is
committed on that member, even if the other member's
transactions have the
<code class="literal">
EVENTUAL
</code>
consistency
level. In other words,
<code class="literal">
AFTER
</code>
and
<code class="literal">
BEFORE_AND_AFTER
</code>
impact
<span class="emphasis">
<em>
all
</em>
</span>
<code class="literal">
ONLINE
</code>
group
members.
</p>
<p>
To illustrate this further, imagine a group with 3 members,
M1, M2 and M3. On member M1 a client issues:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98300938"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">SET</span> <span class="token variable">@@SESSION.group_replication_consistency</span><span class="token operator">=</span> <span class="token keyword">AFTER</span><span class="token punctuation">;</span>
<span class="token operator">></span> <span class="token keyword">BEGIN</span><span class="token punctuation">;</span>
<span class="token operator">></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">></span> <span class="token keyword">COMMIT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Then, while the above transaction is being applied, on member
M2 a client issues:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8402671"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">SET</span> <span class="token keyword">SESSION</span> group_replication_consistency<span class="token operator">=</span> EVENTUAL<span class="token punctuation">;</span></code></pre>
</div>
<p>
In this situation, even though the second transaction's
consistency level is
<code class="literal">
EVENTUAL
</code>
, because it
starts executing while the first transaction is already in the
commit phase on M2, the second transaction has to wait for the
first transaction to finish the commit and only then can it
execute.
</p>
<p>
You can only use the consistency levels
<code class="literal">
BEFORE
</code>
,
<code class="literal">
AFTER
</code>
and
<code class="literal">
BEFORE_AND_AFTER
</code>
on
<code class="literal">
ONLINE
</code>
members, attempting to use them on
members in other states causes a session error.
</p>
<p>
Transactions whose consistency level is not
<code class="literal">
EVENTUAL
</code>
hold execution until a timeout,
configured by
<a class="link" href="server-system-variables.html#sysvar_wait_timeout">
<code class="literal">
wait_timeout
</code>
</a>
value is reached, which defaults to 8 hours. If the timeout is
reached an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gr_hold_wait_timeout" target="_top">
<code class="literal">
ER_GR_HOLD_WAIT_TIMEOUT
</code>
</a>
error
is thrown.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-consistency-level-impact-election">
</a>
Impact of Consistency on Primary Election
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133254064">
</a>
<p>
This section describes how a group's consistency level impacts
on a single-primary group that has elected a new primary. Such
a group automatically detects failures and adjusts the view of
the members that are active, in other words the membership
configuration. Furthermore, if a group is deployed in
single-primary mode, whenever the group's membership changes
there is a check performed to detect if there is still a
primary member in the group. If there is none, a new one is
selected from the list of secondary members. Typically, this
is known as the secondary promotion.
</p>
<p>
Given the fact that the system detects failures and
reconfigures itself automatically, the user may also expect
that once the promotion takes place, the new primary is in the
exact state, data-wise, as that of the old one. In other
words, the user may expect that there is no backlog of
replicated transactions to be applied on the new primary once
he is able to read from and write to it. In practical terms,
the user may expect that once his application fails-over to
the new primary, there would be no chance, even if
temporarily, to read old data or write into old data records.
</p>
<p>
When flow control is activated and properly tuned on a group,
there is only a small chance of transiently reading stale data
from a newly elected primary immediately after the promotion,
as there should not be a backlog, or if there is one it should
be small. Moreover, you might have a proxy or middleware
layers that govern application accesses to the primary after a
promotion and enforce the consistency criteria at that level.
You can specify the behavior of the new primary once it is
promoted using the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
variable, which controls whether a newly elected primary
blocks both reads and writes until after the backlog is fully
applied. If the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
variable was set to
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
on a newly
elected primary which has backlog to apply, and transactions
are issued against the new primary while it is still applying
the backlog, incoming transactions are blocked until the
backlog is fully applied. This prevents the following
anomalies:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
No stale reads for read-only and read/write transactions.
This prevents stale reads from being externalized to the
application by the new primary.
</p>
</li>
<li class="listitem">
<p>
No spurious rollbacks for read/write transactions, due to
write-write conflicts with replicated read/write
transactions still in the backlog waiting to be applied.
</p>
</li>
<li class="listitem">
<p>
No read skew on read/write transactions, such as this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51560980"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">BEGIN</span><span class="token punctuation">;</span>
<span class="token operator">></span> <span class="token keyword">SELECT</span> x <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- x=1 because x=2 is in the backlog;</span>
<span class="token operator">></span> <span class="token keyword">INSERT</span> x <span class="token keyword">INTO</span> t2<span class="token punctuation">;</span>
<span class="token operator">></span> <span class="token keyword">COMMIT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This query should not cause a conflict but writes outdated
values.
</p>
</li>
</ul>
</div>
<p>
To summarize, when
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
is set to
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
you
are choosing to prioritize consistency over availability,
because reads and writes are held whenever a new primary is
elected. This is the trade-off you have to consider when
configuring your group. It should also be remembered that if
flow control is working correctly, backlog should be minimal.
Note that the higher consistency levels
<code class="literal">
BEFORE
</code>
,
<code class="literal">
AFTER
</code>
, and
<code class="literal">
BEFORE_AND_AFTER
</code>
also include the
consistency guarantees provided by
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
.
</p>
<p>
To guarantee that the group provides the same consistency
level regardless of which member is promoted to primary, all
members of the group should have
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
(or a higher
consistency level) persisted to their configuration. For
example, on each member issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa68501941"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">></span> <span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> group_replication_consistency<span class="token operator">=</span><span class="token string">'BEFORE_ON_PRIMARY_FAILOVER'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This ensures that the members all behave in the same way, and
that the configuration is persisted after a restart of the
member.
</p>
<p>
A transaction cannot be on-hold forever, and if the time held
exceeds
<a class="link" href="server-system-variables.html#sysvar_wait_timeout">
<code class="literal">
wait_timeout
</code>
</a>
it
returns an
<span class="errortext">
ER_GR_HOLD_WAIT_TIMEOUT
</span>
error.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-nonblocking">
</a>
Permitted Queries Under Consistency Rules
</h5>
</div>
</div>
</div>
<p>
Although all writes are held when using
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
consistency
level, not all reads are blocked to ensure that you can still
inspect the server while it is applying backlog after a
promotion took place. This is useful for debugging,
monitoring, observability and troubleshooting. Some queries
that do not modify data are allowed, such as the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statements: These are
restricted to those that do not depend on data, only on
status and configuration.
</p>
<p>
The
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statements that
are allowed are
<code class="literal">
SHOW VARIABLES
</code>
,
<code class="literal">
SHOW PROCESSLIST
</code>
,
<code class="literal">
SHOW
STATUS
</code>
,
<code class="literal">
SHOW ENGINE INNODB
LOGS
</code>
,
<code class="literal">
SHOW ENGINE INNODB
STATUS
</code>
,
<code class="literal">
SHOW ENGINE INNODB
MUTEX
</code>
,
<code class="literal">
SHOW BINARY LOG
STATUS
</code>
,
<code class="literal">
SHOW REPLICA STATUS
</code>
,
<code class="literal">
SHOW CHARACTER SET
</code>
,
<code class="literal">
SHOW
COLLATION
</code>
,
<code class="literal">
SHOW BINARY LOGS
</code>
,
<code class="literal">
SHOW OPEN TABLES
</code>
,
<code class="literal">
SHOW
REPLICAS
</code>
,
<code class="literal">
SHOW BINLOG EVENTS
</code>
,
<code class="literal">
SHOW WARNINGS
</code>
,
<code class="literal">
SHOW
ERRORS
</code>
,
<code class="literal">
SHOW ENGINES
</code>
,
<code class="literal">
SHOW PRIVILEGES
</code>
,
<code class="literal">
SHOW
PROCEDURE STATUS
</code>
,
<code class="literal">
SHOW FUNCTION
STATUS
</code>
,
<code class="literal">
SHOW PLUGINS
</code>
,
<code class="literal">
SHOW EVENTS
</code>
,
<code class="literal">
SHOW
PROFILE
</code>
,
<code class="literal">
SHOW PROFILES
</code>
, and
<code class="literal">
SHOW RELAYLOG EVENTS
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
statements
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
statements that do not
use tables or loadable functions
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
EMPTY
</code>
statements
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements
</p>
</li>
<li class="listitem">
<p>
Using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements
against the
<code class="literal">
performance_schema
</code>
and
<code class="literal">
sys
</code>
databases
</p>
</li>
<li class="listitem">
<p>
Using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements
against the
<code class="literal">
PROCESSLIST
</code>
table from the
<code class="literal">
infoschema
</code>
database
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements that do
not use tables or loadable functions
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="stop-group-replication.html" title="15.4.3.2 STOP GROUP_REPLICATION Statement">
<code class="literal">
STOP GROUP_REPLICATION
</code>
</a>
statements
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="shutdown.html" title="15.7.8.9 SHUTDOWN Statement">
<code class="literal">
SHUTDOWN
</code>
</a>
statements
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
statements
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-auto-increment.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-auto-increment">
</a>
19.5.1.1 Replication and AUTO_INCREMENT
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045136010304">
</a>
<a class="indexterm" name="idm46045136008816">
</a>
<a class="indexterm" name="idm46045136007328">
</a>
<a class="indexterm" name="idm46045136005840">
</a>
<a class="indexterm" name="idm46045136004352">
</a>
<a class="indexterm" name="idm46045136002864">
</a>
<p>
Statement-based replication of
<code class="literal">
AUTO_INCREMENT
</code>
,
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
, and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
values is carried out
subject to the following exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A statement invoking a trigger or function that causes an
update to an
<code class="literal">
AUTO_INCREMENT
</code>
column is not
replicated correctly using statement-based replication.
These statements are marked as unsafe. (Bug #45677)
</p>
</li>
<li class="listitem">
<p>
An
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
into a table that
has a composite primary key that includes an
<code class="literal">
AUTO_INCREMENT
</code>
column that is not the
first column of this composite key is not safe for
statement-based logging or replication. These statements are
marked as unsafe. (Bug #11754117, Bug #45670)
</p>
<p>
This issue does not affect tables using the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
storage engine, since an
<code class="literal">
InnoDB
</code>
table with an
<a class="link" href="glossary.html#glos_auto_increment" title="auto-increment">
AUTO_INCREMENT
</a>
column requires at least one key where the auto-increment
column is the only or leftmost column.
</p>
</li>
<li class="listitem">
<p>
Adding an
<code class="literal">
AUTO_INCREMENT
</code>
column to a
table with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
might
not produce the same ordering of the rows on the replica and
the source. This occurs because the order in which the rows
are numbered depends on the specific storage engine used for
the table and the order in which the rows were inserted. If
it is important to have the same order on the source and
replica, the rows must be ordered before assigning an
<code class="literal">
AUTO_INCREMENT
</code>
number. Assuming that you
want to add an
<code class="literal">
AUTO_INCREMENT
</code>
column to a
table
<code class="literal">
t1
</code>
that has columns
<code class="literal">
col1
</code>
and
<code class="literal">
col2
</code>
, the
following statements produce a new table
<code class="literal">
t2
</code>
identical to
<code class="literal">
t1
</code>
but
with an
<code class="literal">
AUTO_INCREMENT
</code>
column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73703429"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token operator">LIKE</span> t1<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t2 <span class="token keyword">ADD</span> id <span class="token datatype">INT</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> col1<span class="token punctuation">,</span> col2<span class="token punctuation">;</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
To guarantee the same ordering on both source and replica,
the
<code class="literal">
ORDER BY
</code>
clause must name
<span class="emphasis">
<em>
all
</em>
</span>
columns of
<code class="literal">
t1
</code>
.
</p>
</div>
<p>
The instructions just given are subject to the limitations
of
<a class="link" href="create-table-like.html" title="15.1.20.3 CREATE TABLE ... LIKE Statement">
<code class="literal">
CREATE
TABLE ... LIKE
</code>
</a>
: Foreign key definitions are
ignored, as are the
<code class="literal">
DATA DIRECTORY
</code>
and
<code class="literal">
INDEX DIRECTORY
</code>
table options. If a table
definition includes any of those characteristics, create
<code class="literal">
t2
</code>
using a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statement that is identical to the one used
to create
<code class="literal">
t1
</code>
, but with the addition of
the
<code class="literal">
AUTO_INCREMENT
</code>
column.
</p>
<p>
Regardless of the method used to create and populate the
copy having the
<code class="literal">
AUTO_INCREMENT
</code>
column,
the final step is to drop the original table and then rename
the copy:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18793241"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> t1<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t2 <span class="token keyword">RENAME</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
See also
<a class="xref" href="alter-table-problems.html" title="B.3.6.1 Problems with ALTER TABLE">
Section B.3.6.1, “Problems with ALTER TABLE”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-replication-mta.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-replication-mta">
</a>
25.7.11 NDB Cluster Replication Using the Multithreaded Applier
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-reqs" title="Requirements">
Requirements
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-config-source" title="MTA Configuration: Source">
MTA Configuration: Source
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-config-replica" title="MTA Configuration: Replica">
MTA Configuration: Replica
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-transaction-deps" title="Transaction Dependency and Writeset Handling">
Transaction Dependency and Writeset Handling
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-writeset-tracking" title="Writeset Tracking Memory Usage">
Writeset Tracking Memory Usage
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-limitations" title="Known Limitations">
Known Limitations
</a>
</p>
</li>
</ul>
</div>
<p>
NDB replication in NDB 8.4 supports the use of the
generic MySQL Server Multithreaded Applier mechanism (MTA), which
allows independent binary log transactions to be applied in
parallel on a replica, increasing peak replication throughput.
</p>
<h4>
<a name="cluster-replication-mta-reqs">
</a>
Requirements
</h4>
<p>
The MySQL Server MTA implementation delegates the processing of
separate binary log transactions to a pool of worker threads
(whose size is configurable), and coordinates the worker threads
to ensure that transaction dependencies encoded in the binary log
are respected, and that commit ordering is maintained if required
(see
<a class="xref" href="replication-threads.html" title="19.2.3 Replication Threads">
Section 19.2.3, “Replication Threads”
</a>
). To use this
functionality with NDB Cluster, it is necessary that the replica
be configured to use multiple worker threads. To do this, set
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
to
control the number of worker threads on the replica. The default
is 4.
</p>
<h4>
<a name="cluster-replication-mta-config-source">
</a>
MTA Configuration: Source
</h4>
<p>
If set on the source
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
,
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_type">
<code class="literal">
replica_parallel_type
</code>
</a>
must be
<code class="literal">
LOGICAL_CLOCK
</code>
(the default value).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
NDB
</code>
does not support
<code class="literal">
replica_parallel_type=DATABASE
</code>
.
</p>
</div>
<p>
In addition, it is recommended that you set the amount of memory
used to track binary log transaction writesets on the source
(
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_dependency_history_size">
<code class="literal">
binlog_transaction_dependency_history_size
</code>
</a>
)
to
<code class="literal">
<em class="replaceable">
<code>
E
</code>
</em>
*
<em class="replaceable">
<code>
P
</code>
</em>
</code>
, where
<em class="replaceable">
<code>
E
</code>
</em>
is the average epoch size (as the
number of operations per epoch) and
<em class="replaceable">
<code>
P
</code>
</em>
is the maximum expected parallelism. See
<a class="xref" href="mysql-cluster-replication-mta.html#cluster-replication-mta-writeset-tracking" title="Writeset Tracking Memory Usage">
Writeset Tracking Memory Usage
</a>
, for
more information.
</p>
<h4>
<a name="cluster-replication-mta-config-replica">
</a>
MTA Configuration: Replica
</h4>
<p>
Replica
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
configuration for the
<code class="literal">
NDB
</code>
MTA requires that
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
is
greater than 1. The recommended starting value when first enabling
MTA is 4, which is the default.
</p>
<p>
In addition,
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order
</code>
</a>
must be
<code class="literal">
ON
</code>
. This is also the default value.
</p>
<h4>
<a name="cluster-replication-mta-transaction-deps">
</a>
Transaction Dependency and Writeset Handling
</h4>
<p>
Transaction dependencies are detected using analysis of each
transaction's writeset, that is, the set of rows (table, key
values) written by the transaction. Where two transactions modify
the same row they are considered to be dependent, and must be
applied in order (in other words, serially) to avoid deadlocks or
incorrect results. Where a table has secondary unique keys, these
values are also added to the transaction's writeset to detect
the case where there are transaction dependencies implied by
different transactions affecting the same unique key value, and so
requiring ordering. Where dependencies cannot be efficiently
determined,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
falls back to considering
transactions dependent for reasons of safety.
</p>
<p>
Transaction dependencies are encoded in the binary log by the
source
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. Dependencies are encoded in an
<code class="literal">
ANONYMOUS_GTID
</code>
event using a scheme called
'Logical clock'. (See
<a class="xref" href="replication-mode-change-online-concepts.html" title="19.1.4.1 Replication Mode Concepts">
Section 19.1.4.1, “Replication Mode Concepts”
</a>
.)
</p>
<p>
The writeset implementation employed by MySQL (and NDB Cluster)
uses hash-based conflict detection based on matching 64-bit row
hashes of relevant table and index values. This detects reliably
when the same key is seen twice, but can also produce false
positives if different table and index values hash to the same
64-bit value; this may result in artificial dependencies which can
reduce the available parallelism.
</p>
<p>
Transaction dependencies are forced by any of the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
DDL statements
</p>
</li>
<li class="listitem">
<p>
Binary log rotation or encountering binary log file boundaries
</p>
</li>
<li class="listitem">
<p>
Writeset history size limitations
</p>
</li>
<li class="listitem">
<p>
Writes which reference parent foreign keys in the target table
</p>
<p>
More specifically, transactions which perform inserts,
updates, and deletes on foreign key
<span class="emphasis">
<em>
parent
</em>
</span>
tables are serialized relative to
all preceding and following transactions, and not just to
those transactions affecting tables involved in a constraint
relationship. Conversely, transactions performing inserts,
updates and deletes on foreign key
<span class="emphasis">
<em>
child
</em>
</span>
tables (referencing) are not especially serialized with regard
to one another.
</p>
</li>
</ul>
</div>
<p>
The MySQL MTA implementation attempts to apply independent binary
log transactions in parallel.
<code class="literal">
NDB
</code>
records all
changes occurring in all user transactions committing in an epoch
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochs">
<code class="literal">
TimeBetweenEpochs
</code>
</a>
,
default 100 milliseconds), in one binary log transaction, referred
to as an epoch transaction. Therefore, for two consecutive epoch
transactions to be independent, and possible to apply in parallel,
it is required that no row is modified in both epochs. If any
single row is modified in both epochs, then they are dependent,
and are applied serially, which can limit the expolitable
parallelism available.
</p>
<p>
Epoch transactions are considered independent based on the set of
rows modified on the source cluster in the epoch, but not
including the generated
<code class="literal">
mysql.ndb_apply_status
</code>
<code class="literal">
WRITE_ROW
</code>
events that convey epoch metadata.
This avoids every epoch transaction being trivially dependent on
the preceding epoch, but does require that the binlog is applied
at the replica with the commit order preserved. This also implies
that an NDB binary log with writeset dependencies is not suitable
for use by a replica database using a different MySQL storage
engine.
</p>
<p>
It may be possible or desirable to modify application transaction
behavior to avoid patterns of repeated modifications to the same
rows, in separate transactions over a short time period, to
increase exploitable apply parallelism.
</p>
<h4>
<a name="cluster-replication-mta-writeset-tracking">
</a>
Writeset Tracking Memory Usage
</h4>
<p>
The amount of memory used to track binary log transaction
writesets can be set using the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_dependency_history_size">
<code class="literal">
binlog_transaction_dependency_history_size
</code>
</a>
server system variable, which defaults to 25000 row hashes.
</p>
<p>
If an average binary log transaction modifies
<em class="replaceable">
<code>
N
</code>
</em>
rows, then to be able to identify
independent (parallelizable) transactions up to a parallelism
level of
<em class="replaceable">
<code>
P
</code>
</em>
, we need
<code class="literal">
binlog_transaction_dependency_history_size
</code>
to
be at least
<code class="literal">
<em class="replaceable">
<code>
N
</code>
</em>
*
<em class="replaceable">
<code>
P
</code>
</em>
</code>
. (The maximum is 1000000.)
</p>
<p>
The finite size of the history results in a finite maximum
dependency length that can be reliably determined, giving a finite
parallelism that can be expressed. Any row not found in the
history may be dependent on the last transaction purged from the
history.
</p>
<p>
Writeset history does not act like a sliding window over the last
<em class="replaceable">
<code>
N
</code>
</em>
transactions; rather, it is a finite
buffer which is allowed to fill up completely, then its contents
entirely discarded when it becomes full. This means that the
history size follows a sawtooth pattern over time, and therefore
the maximum detectable dependency length also follows a sawtooth
pattern over time, such that independent transactions may still be
marked as dependent if the writeset history buffer has been reset
between their being processed.
</p>
<p>
In this scheme, each transaction in a binary log file is annotated
with a
<code class="literal">
sequence_number
</code>
(1, 2, 3, ...), and as
well as the sequence number of the most recent binary log
transaction that it depends on, to which we refer as
<code class="literal">
last_committed
</code>
.
</p>
<p>
Within a given binary log file, the first transaction has
<code class="literal">
sequence_number
</code>
1 and
<code class="literal">
last_committed
</code>
0.
</p>
<p>
Where a binary log transaction depends on its immediate
predecessor, its application is serialized. If the dependency is
on an earlier transaction then it may be possible to apply the
transaction in parallel with the preceding independent
transactions.
</p>
<p>
The content of
<code class="literal">
ANONYMOUS_GTID
</code>
events, including
<code class="literal">
sequence_number
</code>
and
<code class="literal">
last_committed
</code>
(and thus the transaction
dependencies), can be seen using
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
.
</p>
<p>
The
<code class="literal">
ANONYMOUS_GTID
</code>
events generated on the
source are handled separately from the compressed transaction
payload with bulk
<code class="literal">
BEGIN
</code>
,
<code class="literal">
TABLE_MAP*
</code>
,
<code class="literal">
WRITE_ROW*
</code>
,
<code class="literal">
UPDATE_ROW*
</code>
,
<code class="literal">
DELETE_ROW*
</code>
,
and
<code class="literal">
COMMIT
</code>
events, allowing dependencies to be
determined prior to decompression. This means that the replica
coordinator thread can delegate transaction payload decompression
to a worker thread, providing automatic parallel decompression of
independent transactions on the replica.
</p>
<h4>
<a name="cluster-replication-mta-limitations">
</a>
Known Limitations
</h4>
<p>
<b>
Secondary unique columns.
</b>
Tables with secondary unique columns (that is, unique keys other
than the primary key) have all columns sent to the source so
that unique-key related conflicts can be detected.
</p>
<p>
Where the current binary logging mode does not include all
columns, but only changed columns
(
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-log-updated-only">
<code class="option">
--ndb-log-updated-only=OFF
</code>
</a>
,
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-log-update-minimal">
<code class="option">
--ndb-log-update-minimal=ON
</code>
</a>
,
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-log-update-as-write">
<code class="option">
--ndb-log-update-as-write=OFF
</code>
</a>
),
this can increase the volume of data sent from data nodes to SQL
nodes.
</p>
<p>
The impact depends on both the rate of modification (update or
delete) of rows in such tables and the volume of data in columns
which are not actually modified.
</p>
<p>
<b>
Replicating NDB to InnoDB.
</b>
<code class="literal">
NDB
</code>
binary log injector transaction
dependency tracking intentionally ignores the inter-transaction
dependencies created by generated
<code class="literal">
mysql.ndb_apply_status
</code>
metadata events, which
are handled separately as part of the commit of the epoch
transaction on the replica applier. For replication to
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
, there is no special
handling; this may result in reduced performance or other issues
when using an
<code class="literal">
InnoDB
</code>
multithreaded applier to
consume an
<code class="literal">
NDB
</code>
MTA binary log.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/drop-tablespace.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="drop-tablespace">
</a>
15.1.33 DROP TABLESPACE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045183298432">
</a>
<a class="indexterm" name="idm46045183296976">
</a>
<a class="indexterm" name="idm46045183295488">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78997018"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> <span class="token punctuation">[</span><span class="token keyword">UNDO</span><span class="token punctuation">]</span> <span class="token keyword">TABLESPACE</span> <em class="replaceable">tablespace_name</em></code></pre>
</div>
<p>
This statement drops a tablespace that was previously created
using
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
. It is
supported by the
<code class="literal">
NDB
</code>
and
<code class="literal">
InnoDB
</code>
storage engines.
</p>
<p>
The
<code class="literal">
UNDO
</code>
keyword must be specified to drop an
undo tablespace. Only undo tablespaces created using
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE UNDO
TABLESPACE
</code>
</a>
syntax can be dropped. An undo tablespace
must be in an
<code class="literal">
empty
</code>
state before it can be
dropped. For more information, see
<a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
Section 17.6.3.4, “Undo Tablespaces”
</a>
.
</p>
<p>
<code class="literal">
<em class="replaceable">
<code>
tablespace_name
</code>
</em>
</code>
is a
case-sensitive identifier in MySQL.
</p>
<p>
For an
<code class="literal">
InnoDB
</code>
general tablespace, all tables
must be dropped from the tablespace prior to a
<code class="literal">
DROP
TABLESPACE
</code>
operation. If the tablespace is not empty,
<code class="literal">
DROP TABLESPACE
</code>
returns an error.
</p>
<p>
An
<code class="literal">
NDB
</code>
tablespace to be dropped must not
contain any data files; in other words, before you can drop an
<code class="literal">
NDB
</code>
tablespace, you must first drop each of its
data files using
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
... DROP DATAFILE
</code>
</a>
.
</p>
<h4>
<a name="idm46045183275856">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A general
<code class="literal">
InnoDB
</code>
tablespace is not deleted
automatically when the last table in the tablespace is
dropped. The tablespace must be dropped explicitly using
<code class="literal">
DROP TABLESPACE
<em class="replaceable">
<code>
tablespace_name
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
A
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
operation can
drop tables that belong to a general tablespace but it cannot
drop the tablespace, even if the operation drops all tables
that belong to the tablespace. The tablespace must be dropped
explicitly using
<code class="literal">
DROP TABLESPACE
<em class="replaceable">
<code>
tablespace_name
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
Similar to the system tablespace, truncating or dropping
tables stored in a general tablespace creates free space
internally in the general tablespace
<a class="link" href="glossary.html#glos_ibd_file" title=".ibd file">
.ibd data file
</a>
which can
only be used for new
<code class="literal">
InnoDB
</code>
data. Space is
not released back to the operating system as it is for
file-per-table tablespaces.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045183266112">
</a>
InnoDB Examples
</h4>
<p>
This example demonstrates how to drop an
<code class="literal">
InnoDB
</code>
general tablespace. The general tablespace
<code class="literal">
ts1
</code>
is created with a single table. Before dropping the tablespace,
the table must be dropped.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25238966"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLESPACE</span> <span class="token punctuation">`</span>ts1<span class="token punctuation">`</span> <span class="token keyword">ADD</span> <span class="token keyword">DATAFILE</span> <span class="token string">'ts1.ibd'</span> <span class="token keyword">Engine</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">INT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">)</span> <span class="token keyword">TABLESPACE</span> ts1 <span class="token keyword">Engine</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> t1<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLESPACE</span> ts1<span class="token punctuation">;</span></code></pre>
</div>
<p>
This example demonstrates dropping an undo tablespace. An undo
tablespace must be in an
<code class="literal">
empty
</code>
state before it
can be dropped. For more information, see
<a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
Section 17.6.3.4, “Undo Tablespaces”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8881016"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">UNDO</span> <span class="token keyword">TABLESPACE</span> <em class="replaceable">undo_003</em><span class="token punctuation">;</span></code></pre>
</div>
<h4>
<a name="idm46045183255600">
</a>
NDB Example
</h4>
<p>
This example shows how to drop an
<code class="literal">
NDB
</code>
tablespace
<code class="literal">
myts
</code>
having a data file named
<code class="filename">
mydata-1.dat
</code>
after first creating the
tablespace, and assumes the existence of a log file group named
<code class="literal">
mylg
</code>
(see
<a class="xref" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
Section 15.1.16, “CREATE LOGFILE GROUP Statement”
</a>
).
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13242680"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLESPACE</span> myts
<span class="token prompt"> -></span> <span class="token keyword">ADD</span> <span class="token keyword">DATAFILE</span> <span class="token string">'mydata-1.dat'</span>
<span class="token prompt"> -></span> <span class="token keyword">USE</span> <span class="token keyword">LOGFILE</span> <span class="token keyword">GROUP</span> mylg
<span class="token prompt"> -></span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You must remove all data files from the tablespace using
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
, as shown here,
before it can be dropped:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58042153"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLESPACE</span> myts
<span class="token prompt"> -></span> <span class="token keyword">DROP</span> <span class="token keyword">DATAFILE</span> <span class="token string">'mydata-1.dat'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLESPACE</span> myts<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/keyring-aws-plugin.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="keyring-aws-plugin">
</a>
8.4.4.7 Using the keyring_aws Amazon Web Services Keyring Plugin
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240452000">
</a>
<a class="indexterm" name="idm46045240450944">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
keyring_aws
</code>
plugin is an extension
included in MySQL Enterprise Edition, a commercial product. To learn more about
commercial products, see
<a class="ulink" href="https://www.mysql.com/products/" target="_blank">
https://www.mysql.com/products/
</a>
.
</p>
</div>
<p>
The
<code class="literal">
keyring_aws
</code>
keyring plugin communicates
with the Amazon Web Services Key Management Service (AWS KMS) as
a back end for key generation and uses a local file for key
storage. All keyring material is generated exclusively by the
AWS server, not by
<code class="literal">
keyring_aws
</code>
.
</p>
<p>
MySQL Enterprise Edition can work with
<code class="literal">
keyring_aws
</code>
on Red Hat
Enterprise Linux, SUSE Linux Enterprise Server, Debian, Ubuntu,
macOS, and Windows. MySQL Enterprise Edition does not support the use of
<code class="literal">
keyring_aws
</code>
on these platforms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
EL6
</p>
</li>
<li class="listitem">
<p>
Generic Linux (glibc2.12)
</p>
</li>
<li class="listitem">
<p>
SLES 12 (with versions after MySQL Server 5.7)
</p>
</li>
<li class="listitem">
<p>
Solaris
</p>
</li>
</ul>
</div>
<p>
The discussion here assumes that you are familiar with AWS in
general and KMS in particular. Some pertinent information
sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="https://aws.amazon.com/kms/" target="_blank">
AWS site
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="https://docs.aws.amazon.com/kms/" target="_blank">
KMS
documentation
</a>
</p>
</li>
</ul>
</div>
<p>
The following sections provide configuration and usage
information for the
<code class="literal">
keyring_aws
</code>
keyring
plugin:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="keyring-aws-plugin.html#keyring-aws-plugin-configuration" title="keyring_aws Configuration">
keyring_aws Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-aws-plugin.html#keyring-aws-plugin-operation" title="keyring_aws Operation">
keyring_aws Operation
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-aws-plugin.html#keyring-aws-plugin-credential-changes" title="keyring_aws Credential Changes">
keyring_aws Credential Changes
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-aws-plugin-configuration">
</a>
keyring_aws Configuration
</h5>
</div>
</div>
</div>
<p>
To install
<code class="literal">
keyring_aws
</code>
, use the general
instructions found in
<a class="xref" href="keyring-plugin-installation.html" title="8.4.4.3 Keyring Plugin Installation">
Section 8.4.4.3, “Keyring Plugin Installation”
</a>
, together with
the plugin-specific configuration information found here.
</p>
<p>
The plugin library file contains the
<code class="literal">
keyring_aws
</code>
plugin and two loadable
functions,
<a class="link" href="keyring-functions-plugin-specific.html#function_keyring-aws-rotate-cmk">
<code class="literal">
keyring_aws_rotate_cmk()
</code>
</a>
and
<a class="link" href="keyring-functions-plugin-specific.html#function_keyring-aws-rotate-keys">
<code class="literal">
keyring_aws_rotate_keys()
</code>
</a>
.
</p>
<p>
To configure
<code class="literal">
keyring_aws
</code>
, you must obtain a
secret access key that provides credentials for communicating
with AWS KMS and write it to a configuration file:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create an AWS KMS account.
</p>
</li>
<li class="listitem">
<p>
Use AWS KMS to create a secret access key ID and secret
access key. The access key serves to verify your identity
and that of your applications.
</p>
</li>
<li class="listitem">
<p>
Use the AWS KMS account to create a KMS key ID. At MySQL
startup, set the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_cmk_id">
<code class="literal">
keyring_aws_cmk_id
</code>
</a>
system
variable to the CMK ID value. This variable is mandatory
and there is no default. (Its value can be changed at
runtime if desired using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
.)
</p>
</li>
<li class="listitem">
<p>
If necessary, create the directory in which the
configuration file should be located. The directory should
have a restrictive mode and be accessible only to the
account used to run the MySQL server. For example, on Unix
and Unix-like systems, to use
<code class="filename">
/usr/local/mysql/mysql-keyring/keyring_aws_conf
</code>
as the file name, the following commands (executed as
<code class="literal">
root
</code>
) create its parent directory and
set the directory mode and ownership:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa19766366"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">cd</span> /usr/local/mysql
<span class="token prompt">$> </span><span class="token command">mkdir</span> mysql-keyring
<span class="token prompt">$> </span><span class="token command">chmod</span> 750 mysql-keyring
<span class="token prompt">$> </span><span class="token command">chown</span> mysql mysql-keyring
<span class="token prompt">$> </span><span class="token command">chgrp</span> mysql mysql-keyring</code></pre>
</div>
<p>
At MySQL startup, set the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_conf_file">
<code class="literal">
keyring_aws_conf_file
</code>
</a>
system variable to
<code class="filename">
/usr/local/mysql/mysql-keyring/keyring_aws_conf
</code>
to indicate the configuration file location to the server.
</p>
</li>
<li class="listitem">
<p>
Prepare the
<code class="literal">
keyring_aws
</code>
configuration
file, which should contain two lines:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Line 1: The secret access key ID
</p>
</li>
<li class="listitem">
<p>
Line 2: The secret access key
</p>
</li>
</ul>
</div>
<p>
For example, if the key ID is
<code class="literal">
wwwwwwwwwwwwwEXAMPLE
</code>
and the key is
<code class="literal">
xxxxxxxxxxxxx/yyyyyyy/zzzzzzzzEXAMPLEKEY
</code>
,
the configuration file looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa62622299"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">wwwwwwwwwwwwwEXAMPLE
xxxxxxxxxxxxx/yyyyyyy/zzzzzzzzEXAMPLEKEY</code></pre>
</div>
</li>
</ol>
</div>
<p>
To be usable during the server startup process,
<code class="literal">
keyring_aws
</code>
must be loaded using the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option. The
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_cmk_id">
<code class="literal">
keyring_aws_cmk_id
</code>
</a>
system
variable is mandatory and configures the KMS key ID obtained
from the AWS KMS server. The
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_conf_file">
<code class="literal">
keyring_aws_conf_file
</code>
</a>
and
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_data_file">
<code class="literal">
keyring_aws_data_file
</code>
</a>
system
variables optionally configure the locations of the files used
by the
<code class="literal">
keyring_aws
</code>
plugin for configuration
information and data storage. The file location variable
default values are platform specific. To configure the
locations explicitly, set the variable values at startup. For
example, use these lines in the server
<code class="filename">
my.cnf
</code>
file, adjusting the
<code class="filename">
.so
</code>
suffix and file locations for your
platform as necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa27168296"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">early-plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_aws.so</span>
<span class="token constant">keyring_aws_cmk_id</span><span class="token attr-value"><span class="token punctuation">=</span>'arn:aws:kms:us-west-2:111122223333:key/abcd1234-ef56-ab12-cd34-ef56abcd1234'</span>
<span class="token constant">keyring_aws_conf_file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mysql-keyring/keyring_aws_conf</span>
<span class="token constant">keyring_aws_data_file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mysql-keyring/keyring_aws_data</span></code></pre>
</div>
<p>
For the
<code class="literal">
keyring_aws
</code>
plugin to start
successfully, the configuration file must exist and contain
valid secret access key information, initialized as described
previously. The storage file need not exist. If it does not,
<code class="literal">
keyring_aws
</code>
attempts to create it (as well
as its parent directory, if necessary).
</p>
<p>
For additional information about the system variables used to
configure the
<code class="literal">
keyring_aws
</code>
plugin, see
<a class="xref" href="keyring-system-variables.html" title="8.4.4.16 Keyring System Variables">
Section 8.4.4.16, “Keyring System Variables”
</a>
.
</p>
<p>
Start the MySQL server and install the functions associated
with the
<code class="literal">
keyring_aws
</code>
plugin. This is a
one-time operation, performed by executing the following
statements, adjusting the
<code class="filename">
.so
</code>
suffix for
your platform as necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9424985"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> keyring_aws_rotate_cmk <span class="token keyword">RETURNS</span> <span class="token datatype">INTEGER</span>
<span class="token keyword">SONAME</span> <span class="token string">'keyring_aws.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> keyring_aws_rotate_keys <span class="token keyword">RETURNS</span> <span class="token datatype">INTEGER</span>
<span class="token keyword">SONAME</span> <span class="token string">'keyring_aws.so'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For additional information about the
<code class="literal">
keyring_aws
</code>
functions, see
<a class="xref" href="keyring-functions-plugin-specific.html" title="8.4.4.13 Plugin-Specific Keyring Key-Management Functions">
Section 8.4.4.13, “Plugin-Specific Keyring Key-Management Functions”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-aws-plugin-operation">
</a>
keyring_aws Operation
</h5>
</div>
</div>
</div>
<p>
At plugin startup, the
<code class="literal">
keyring_aws
</code>
plugin
reads the AWS secret access key ID and key from its
configuration file. It also reads any encrypted keys contained
in its storage file into its in-memory cache.
</p>
<p>
During operation,
<code class="literal">
keyring_aws
</code>
maintains
encrypted keys in the in-memory cache and uses the storage
file as local persistent storage. Each keyring operation is
transactional:
<code class="literal">
keyring_aws
</code>
either
successfully changes both the in-memory key cache and the
keyring storage file, or the operation fails and the keyring
state remains unchanged.
</p>
<p>
To ensure that keys are flushed only when the correct keyring
storage file exists,
<code class="literal">
keyring_aws
</code>
stores a
SHA-256 checksum of the keyring in the file. Before updating
the file, the plugin verifies that it contains the expected
checksum.
</p>
<p>
The
<code class="literal">
keyring_aws
</code>
plugin supports the
functions that comprise the standard MySQL Keyring service
interface. Keyring operations performed by these functions are
accessible at two levels:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL interface: In SQL statements, call the functions
described in
<a class="xref" href="keyring-functions-general-purpose.html" title="8.4.4.12 General-Purpose Keyring Key-Management Functions">
Section 8.4.4.12, “General-Purpose Keyring Key-Management Functions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
C interface: In C-language code, call the keyring service
functions described in
<a class="xref" href="keyring-service.html" title="7.6.9.2 The Keyring Service">
Section 7.6.9.2, “The Keyring Service”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Example (using the SQL interface):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48028531"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> keyring_key_generate<span class="token punctuation">(</span><span class="token string">'MyKey'</span><span class="token punctuation">,</span> <span class="token string">'AES'</span><span class="token punctuation">,</span> <span class="token number">32</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> keyring_key_remove<span class="token punctuation">(</span><span class="token string">'MyKey'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In addition, the
<a class="link" href="keyring-functions-plugin-specific.html#function_keyring-aws-rotate-cmk">
<code class="literal">
keyring_aws_rotate_cmk()
</code>
</a>
and
<a class="link" href="keyring-functions-plugin-specific.html#function_keyring-aws-rotate-keys">
<code class="literal">
keyring_aws_rotate_keys()
</code>
</a>
functions
<span class="quote">
“
<span class="quote">
extend
</span>
”
</span>
the keyring plugin interface
to provide AWS-related capabilities not covered by the
standard keyring service interface. These capabilities are
accessible only by calling these functions using SQL. There
are no corresponding C-language key service functions.
</p>
<p>
For information about the characteristics of key values
permitted by
<code class="literal">
keyring_aws
</code>
, see
<a class="xref" href="keyring-key-types.html" title="8.4.4.10 Supported Keyring Key Types and Lengths">
Section 8.4.4.10, “Supported Keyring Key Types and Lengths”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-aws-plugin-credential-changes">
</a>
keyring_aws Credential Changes
</h5>
</div>
</div>
</div>
<p>
Assuming that the
<code class="literal">
keyring_aws
</code>
plugin has
initialized properly at server startup, it is possible to
change the credentials used for communicating with AWS KMS:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Use AWS KMS to create a new secret access key ID and
secret access key.
</p>
</li>
<li class="listitem">
<p>
Store the new credentials in the configuration file (the
file named by the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_aws_conf_file">
<code class="literal">
keyring_aws_conf_file
</code>
</a>
system variable). The file format is as described
previously.
</p>
</li>
<li class="listitem">
<p>
Reinitialize the
<code class="literal">
keyring_aws
</code>
plugin so
that it re-reads the configuration file. Assuming that the
new credentials are valid, the plugin should initialize
successfully.
</p>
<p>
There are two ways to reinitialize the plugin:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Restart the server. This is simpler and has no side
effects, but is not suitable for installations that
require minimal server downtime with as few restarts
as possible.
</p>
</li>
<li class="listitem">
<p>
Reinitialize the plugin without restarting the server
by executing the following statements, adjusting the
<code class="filename">
.so
</code>
suffix for your platform as
necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94751389"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UNINSTALL</span> <span class="token keyword">PLUGIN</span> keyring_aws<span class="token punctuation">;</span>
<span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> keyring_aws <span class="token keyword">SONAME</span> <span class="token string">'keyring_aws.so'</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In addition to loading a plugin at runtime,
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
has
the side effect of registering the plugin it in the
<code class="literal">
mysql.plugin
</code>
system table.
Because of this, if you decide to stop using
<code class="literal">
keyring_aws
</code>
, it is not sufficient
to remove the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option from the set of options used to start the
server. That stops the plugin from loading early,
but the server still attempts to load it when it
gets to the point in the startup sequence where it
loads the plugins registered in
<code class="literal">
mysql.plugin
</code>
.
</p>
<p>
Consequently, if you execute the
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
plus
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
sequence just described to change the AWS KMS
credentials, then to stop using
<code class="literal">
keyring_aws
</code>
, it is necessary to
execute
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL
PLUGIN
</code>
</a>
again to unregister the plugin in
addition to removing the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option.
</p>
</div>
</li>
</ul>
</div>
</li>
</ol>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/engine-condition-pushdown-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="engine-condition-pushdown-optimization">
</a>
10.2.1.5 Engine Condition Pushdown Optimization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045229708800">
</a>
<a class="indexterm" name="idm46045229707712">
</a>
<p>
This optimization improves the efficiency of direct
comparisons between a nonindexed column and a constant. In
such cases, the condition is
<span class="quote">
“
<span class="quote">
pushed down
</span>
”
</span>
to the
storage engine for evaluation. This optimization can be used
only by the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine.
</p>
<p>
For NDB Cluster, this optimization can eliminate the need to
send nonmatching rows over the network between the
cluster's data nodes and the MySQL server that issued the
query, and can speed up queries where it is used by a factor
of 5 to 10 times over cases where condition pushdown could be
but is not used.
</p>
<p>
Suppose that an NDB Cluster table is defined as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11910947"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Engine condition pushdown can be used with queries such as the
one shown here, which includes a comparison between a
nonindexed column and a constant:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa71460055"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> a<span class="token punctuation">,</span> b <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The use of engine condition pushdown can be seen in the output
of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14438267"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> a<span class="token punctuation">,</span> b <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">10</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 10
Extra<span class="token punctuation">:</span> Using where with pushed condition</span></code></pre>
</div>
<p>
However, engine condition pushdown
<span class="emphasis">
<em>
cannot
</em>
</span>
be used with the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97086757"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> a<span class="token punctuation">,</span>b <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> a <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Engine condition pushdown is not applicable here because an
index exists on column
<code class="literal">
a
</code>
. (An index access
method would be more efficient and so would be chosen in
preference to condition pushdown.)
</p>
<p>
Engine condition pushdown may also be employed when an indexed
column is compared with a constant using a
<code class="literal">
>
</code>
or
<code class="literal">
<
</code>
operator:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60798542"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> a<span class="token punctuation">,</span> b <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> a <span class="token operator"><</span> <span class="token number">2</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
type<span class="token punctuation">:</span> range
possible_keys<span class="token punctuation">:</span> a
key<span class="token punctuation">:</span> a
key_len<span class="token punctuation">:</span> 5
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 2
Extra<span class="token punctuation">:</span> Using where with pushed condition</span></code></pre>
</div>
<p>
Other supported comparisons for engine condition pushdown
include the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
column
</code>
</em>
[NOT] LIKE
<em class="replaceable">
<code>
pattern
</code>
</em>
</code>
</p>
<p>
<em class="replaceable">
<code>
pattern
</code>
</em>
must be a string
literal containing the pattern to be matched; for syntax,
see
<a class="xref" href="string-comparison-functions.html" title="14.8.1 String Comparison Functions and Operators">
Section 14.8.1, “String Comparison Functions and Operators”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
column
</code>
</em>
IS [NOT]
NULL
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
column
</code>
</em>
IN
(
<em class="replaceable">
<code>
value_list
</code>
</em>
)
</code>
</p>
<p>
Each item in the
<em class="replaceable">
<code>
value_list
</code>
</em>
must be a constant, literal value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
column
</code>
</em>
BETWEEN
<em class="replaceable">
<code>
constant1
</code>
</em>
AND
<em class="replaceable">
<code>
constant2
</code>
</em>
</code>
</p>
<p>
<em class="replaceable">
<code>
constant1
</code>
</em>
and
<em class="replaceable">
<code>
constant2
</code>
</em>
must each be a
constant, literal value.
</p>
</li>
</ul>
</div>
<p>
In all of the cases in the preceding list, it is possible for
the condition to be converted into the form of one or more
direct comparisons between a column and a constant.
</p>
<p>
Engine condition pushdown is enabled by default. To disable it
at server startup, set the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable's
<a class="link" href="switchable-optimizations.html#optflag_engine-condition-pushdown">
<code class="literal">
engine_condition_pushdown
</code>
</a>
flag to
<code class="literal">
off
</code>
. For example, in a
<code class="filename">
my.cnf
</code>
file, use these lines:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa1475101"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">optimizer_switch</span><span class="token attr-value"><span class="token punctuation">=</span>engine_condition_pushdown=off</span></code></pre>
</div>
<p>
At runtime, disable condition pushdown like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa92286628"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> optimizer_switch<span class="token operator">=</span><span class="token string">'engine_condition_pushdown=off'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<b>
Limitations.
</b>
Engine condition pushdown is subject to the following
limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Engine condition pushdown is supported only by the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine.
</p>
</li>
<li class="listitem">
<p>
In NDB 8.4, columns can be compared with one
another as long as they are of exactly the same type,
including the same signedness, length, character set,
precision, and scale, where these are applicable.
</p>
</li>
<li class="listitem">
<p>
Columns used in comparisons cannot be of any of the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
types. This exclusion
extends to
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
,
<a class="link" href="bit-type.html" title="13.1.5 Bit-Value Type - BIT">
<code class="literal">
BIT
</code>
</a>
, and
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
columns as well.
</p>
</li>
<li class="listitem">
<p>
A string value to be compared with a column must use the
same collation as the column.
</p>
</li>
<li class="listitem">
<p>
Joins are not directly supported; conditions involving
multiple tables are pushed separately where possible. Use
extended
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output to
determine which conditions are actually pushed down. See
<a class="xref" href="explain-extended.html" title="10.8.3 Extended EXPLAIN Output Format">
Section 10.8.3, “Extended EXPLAIN Output Format”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Previously, engine condition pushdown was limited to terms
referring to column values from the same table to which the
condition was being pushed. In NDB 8.4, column
values from tables earlier in the query plan can also be
referred to from pushed conditions. This reduces the number of
rows which must be handled by the SQL node during join
processing. Filtering can be also performed in parallel in the
LDM threads, rather than in a single
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process. This has the potential to improve performance of
queries by a significant margin.
</p>
<p>
<code class="literal">
NDB
</code>
can push an outer join using a scan if
there are no unpushable conditions on any table used in the
same join nest, or on any table in join nests above it on
which it depends. This is also true for a semijoin, provided
the optimization strategy employed is
<code class="literal">
firstMatch
</code>
(see
<a class="ulink" href="/doc/refman/8.0/en/semijoins.html" target="_top">
Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations
</a>
).
</p>
<p>
Join algorithms cannot be combined with referring columns from
previous tables in the following two situations:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
When any of the referred previous tables are in a join
buffer. In this case, each row retrieved from the
scan-filtered table is matched against every row in the
buffer. This means that there is no single specific row
from which column values can be fetched from when
generating the scan filter.
</p>
</li>
<li class="listitem">
<p>
When the column originates from a child operation in a
pushed join. This is because rows referenced from ancestor
operations in the join have not yet been retrieved when
the scan filter is generated.
</p>
</li>
</ol>
</div>
<p>
Columns from ancestor tables in a join can be pushed down,
provided that they meet the requirements listed previously. An
example of such a query, using the table
<code class="literal">
t1
</code>
created previously, is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51716798"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span>
<span class="token prompt"> -></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">AS</span> x
<span class="token prompt"> -></span> <span class="token keyword">LEFT</span> <span class="token keyword">JOIN</span> t1 <span class="token keyword">AS</span> y
<span class="token prompt"> -></span> <span class="token keyword">ON</span> x<span class="token punctuation">.</span>a<span class="token operator">=</span><span class="token number">0</span> <span class="token operator">AND</span> y<span class="token punctuation">.</span>b<span class="token operator">>=</span><span class="token number">3</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> x
partitions<span class="token punctuation">:</span> p0,p1
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 4
filtered<span class="token punctuation">:</span> 100.00
Extra<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> y
partitions<span class="token punctuation">:</span> p0,p1
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 4
filtered<span class="token punctuation">:</span> 100.00
Extra<span class="token punctuation">:</span> Using where; Using pushed condition (`test`.`y`.`b` >= 3); Using join buffer (hash join)
</span><span class="token output">2 rows in set, 2 warnings (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-firewall-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-firewall-tables">
</a>
29.12.17 Performance Schema Firewall Tables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="performance-schema-firewall-groups-table.html">
29.12.17.1 The firewall_groups Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-firewall-group-allowlist-table.html">
29.12.17.2 The firewall_group_allowlist Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-firewall-membership-table.html">
29.12.17.3 The firewall_membership Table
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045069598416">
</a>
<p>
The following sections describe the Performance Schema tables
associated with MySQL Enterprise Firewall (see
<a class="xref" href="firewall.html" title="8.4.7 MySQL Enterprise Firewall">
Section 8.4.7, “MySQL Enterprise Firewall”
</a>
). They
provide information about firewall operation:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-firewall-groups-table.html" title="29.12.17.1 The firewall_groups Table">
<code class="literal">
firewall_groups
</code>
</a>
: Information
about firewall group profiles.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-firewall-group-allowlist-table.html" title="29.12.17.2 The firewall_group_allowlist Table">
<code class="literal">
firewall_group_allowlist
</code>
</a>
:
Allowlist rules of registered firewall group profiles.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-firewall-membership-table.html" title="29.12.17.3 The firewall_membership Table">
<code class="literal">
firewall_membership
</code>
</a>
: Members
(accounts) of registered firewall group profiles.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-troubleshooting-datadict.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-troubleshooting-datadict">
</a>
17.20.4 Troubleshooting InnoDB Data Dictionary Operations
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045148911232">
</a>
<p>
Information about table definitions is stored in the InnoDB
<a class="link" href="glossary.html#glos_data_dictionary" title="data dictionary">
data dictionary
</a>
. If
you move data files around, dictionary data can become
inconsistent.
</p>
<p>
If a data dictionary corruption or consistency issue prevents you
from starting
<code class="literal">
InnoDB
</code>
, see
<a class="xref" href="forcing-innodb-recovery.html" title="17.20.3 Forcing InnoDB Recovery">
Section 17.20.3, “Forcing InnoDB Recovery”
</a>
for information about
manual recovery.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-cannot-open-data-file-error">
</a>
Cannot Open Datafile
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045148904880">
</a>
<p>
With
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
enabled (the default), the following messages may appear at
startup if a
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
tablespace file (
<code class="literal">
.ibd
</code>
file) is missing:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa72388707"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> InnoDB<span class="token punctuation">:</span> Operating system error number 2 in a file operation<span class="token punctuation">.</span>
<span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> InnoDB<span class="token punctuation">:</span> The error means the system cannot find the path specified<span class="token punctuation">.</span>
<span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> InnoDB<span class="token punctuation">:</span> Cannot open datafile for read-only<span class="token punctuation">:</span> <span class="token atrule">'./test/t1.ibd'</span> OS error<span class="token punctuation">:</span> 71
<span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> InnoDB<span class="token punctuation">:</span> Ignoring tablespace `test/t1` because it could not be opened<span class="token punctuation">.</span></code></pre>
</div>
<p>
To address these messages, issue
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP
TABLE
</code>
</a>
statement to remove data about the missing table
from the data dictionary.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="restoring-orphaned-ibd-files">
</a>
Restoring Orphan File-Per-Table ibd Files
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045148895344">
</a>
<p>
This procedure describes how to restore orphan
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
<code class="filename">
.ibd
</code>
files to another MySQL instance. You
might use this procedure if the system tablespace is lost or
unrecoverable and you want to restore
<code class="filename">
.ibd
</code>
file backups on a new MySQL instance.
</p>
<p>
The procedure is not supported for
<a class="link" href="glossary.html#glos_general_tablespace" title="general tablespace">
general
tablespace
</a>
<code class="filename">
.ibd
</code>
files.
</p>
<p>
The procedure assumes that you only have
<code class="filename">
.ibd
</code>
file backups, you are recovering to
the same version of MySQL that initially created the orphan
<code class="filename">
.ibd
</code>
files, and that
<code class="filename">
.ibd
</code>
file backups are clean. See
<a class="xref" href="innodb-migration.html" title="17.6.1.4 Moving or Copying InnoDB Tables">
Section 17.6.1.4, “Moving or Copying InnoDB Tables”
</a>
for information about
creating clean backups.
</p>
<p>
Table import limitations outlined in
<a class="xref" href="innodb-table-import.html" title="17.6.1.3 Importing InnoDB Tables">
Section 17.6.1.3, “Importing InnoDB Tables”
</a>
are applicable to this
procedure.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the new MySQL instance, recreate the table in a database
of the same name.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85663268"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">DATABASE</span> sakila<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">USE</span> sakila<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> actor <span class="token punctuation">(</span>
<span class="token prompt"> -></span> actor_id <span class="token datatype">SMALLINT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> first_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">45</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> last_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">45</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> last_update <span class="token datatype">TIMESTAMP</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">CURRENT_TIMESTAMP</span> <span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">CURRENT_TIMESTAMP</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>actor_id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">KEY</span> idx_actor_last_name <span class="token punctuation">(</span>last_name<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB <span class="token keyword">DEFAULT</span> <span class="token keyword">CHARSET</span><span class="token operator">=</span>utf8mb4<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Discard the tablespace of the newly created table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa77444156"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> sakila<span class="token punctuation">.</span>actor <span class="token keyword">DISCARD</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the orphan
<code class="literal">
.ibd
</code>
file from your
backup directory to the new database directory.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa54312260"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">cp</span> /backup_directory/actor<span class="token punctuation">.</span>ibd <em class="replaceable">path/to/mysql-5<span class="token punctuation">.</span>7/data</em>/sakila/</code></pre>
</div>
</li>
<li class="listitem">
<p>
Ensure that the
<code class="filename">
.ibd
</code>
file has the
necessary file permissions.
</p>
</li>
<li class="listitem">
<p>
Import the orphan
<code class="literal">
.ibd
</code>
file. A warning is
issued indicating that
<code class="literal">
InnoDB
</code>
is
attempting to import the file without schema verification.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53060577"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> sakila<span class="token punctuation">.</span>actor <span class="token keyword">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (0.15 sec)</span>
Warning <span class="token operator">|</span> <span class="token number">1810</span> <span class="token operator">|</span> InnoDB: <span class="token keyword">IO</span> <span class="token keyword">Read</span> <span class="token keyword">error</span>: <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token keyword">No</span> such <span class="token keyword">file</span> <span class="token operator">or</span> <span class="token keyword">directory</span><span class="token punctuation">)</span>
<span class="token keyword">Error</span> opening <span class="token string">'./sakila/actor.cfg'</span><span class="token punctuation">,</span> will attempt <span class="token keyword">to</span> <span class="token keyword">import</span>
<span class="token keyword">without</span> <span class="token keyword">schema</span> verification</code></pre>
</div>
</li>
<li class="listitem">
<p>
Query the table to verify that the
<code class="literal">
.ibd
</code>
file was successfully restored.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97536051"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> sakila<span class="token punctuation">.</span>actor<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> count(*) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 200 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ol>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/set.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="set">
</a>
13.3.6 The SET Type
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045212348352">
</a>
<a class="indexterm" name="idm46045212347280">
</a>
<p>
A
<code class="literal">
SET
</code>
is a string object that can have zero
or more values, each of which must be chosen from a list of
permitted values specified when the table is created.
<code class="literal">
SET
</code>
column values that consist of multiple
set members are specified with members separated by commas
(
<code class="literal">
,
</code>
). A consequence of this is that
<code class="literal">
SET
</code>
member values should not themselves
contain commas.
</p>
<p>
For example, a column specified as
<code class="literal">
SET('one', 'two')
NOT NULL
</code>
can have any of these values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa11968727"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">''
'one'
'two'
'one<span class="token punctuation">,</span>two'</code></pre>
</div>
<p>
A
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
column can have a maximum
of 64 distinct members.
</p>
<p>
Duplicate values in the definition cause a warning, or an error
if strict SQL mode is enabled.
</p>
<a class="indexterm" name="idm46045212338000">
</a>
<p>
Trailing spaces are automatically deleted from
<code class="literal">
SET
</code>
member values in the table definition
when a table is created.
</p>
<p>
See
<a class="xref" href="storage-requirements.html#data-types-storage-reqs-strings" title="String Type Storage Requirements">
String Type Storage Requirements
</a>
for
storage requirements for the
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
type.
</p>
<p>
See
<a class="xref" href="string-type-syntax.html" title="13.3.1 String Data Type Syntax">
Section 13.3.1, “String Data Type Syntax”
</a>
for
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
type syntax and length
limits.
</p>
<p>
When retrieved, values stored in a
<code class="literal">
SET
</code>
column
are displayed using the lettercase that was used in the column
definition. Note that
<code class="literal">
SET
</code>
columns can be
assigned a character set and collation. For binary or
case-sensitive collations, lettercase is taken into account when
assigning values to the column.
</p>
<p>
MySQL stores
<code class="literal">
SET
</code>
values numerically, with the
low-order bit of the stored value corresponding to the first set
member. If you retrieve a
<code class="literal">
SET
</code>
value in a
numeric context, the value retrieved has bits set corresponding
to the set members that make up the column value. For example,
you can retrieve numeric values from a
<code class="literal">
SET
</code>
column like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa85681309"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <em class="replaceable">set_col</em><span class="token operator">+</span><span class="token number">0</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
If a number is stored into a
<code class="literal">
SET
</code>
column, the
bits that are set in the binary representation of the number
determine the set members in the column value. For a column
specified as
<code class="literal">
SET('a','b','c','d')
</code>
, the
members have the following decimal and binary values.
</p>
<div class="informaltable">
<table summary="Decimal and binary values for members of a column specified as SET('a','b','c','d').">
<colgroup>
<col style="width: 15%"/>
<col style="width: 20%"/>
<col style="width: 20%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<code class="literal">
SET
</code>
Member
</th>
<th scope="col">
Decimal Value
</th>
<th scope="col">
Binary Value
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
'a'
</code>
</th>
<td>
<code class="literal">
1
</code>
</td>
<td>
<code class="literal">
0001
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'b'
</code>
</th>
<td>
<code class="literal">
2
</code>
</td>
<td>
<code class="literal">
0010
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'c'
</code>
</th>
<td>
<code class="literal">
4
</code>
</td>
<td>
<code class="literal">
0100
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'd'
</code>
</th>
<td>
<code class="literal">
8
</code>
</td>
<td>
<code class="literal">
1000
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If you assign a value of
<code class="literal">
9
</code>
to this column,
that is
<code class="literal">
1001
</code>
in binary, so the first and
fourth
<code class="literal">
SET
</code>
value members
<code class="literal">
'a'
</code>
and
<code class="literal">
'd'
</code>
are selected
and the resulting value is
<code class="literal">
'a,d'
</code>
.
</p>
<p>
For a value containing more than one
<code class="literal">
SET
</code>
element, it does not matter what order the elements are listed
in when you insert the value. It also does not matter how many
times a given element is listed in the value. When the value is
retrieved later, each element in the value appears once, with
elements listed according to the order in which they were
specified at table creation time. Suppose that a column is
specified as
<code class="literal">
SET('a','b','c','d')
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa30812259"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> myset <span class="token punctuation">(</span>col <span class="token datatype">SET</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">,</span> <span class="token string">'b'</span><span class="token punctuation">,</span> <span class="token string">'c'</span><span class="token punctuation">,</span> <span class="token string">'d'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you insert the values
<code class="literal">
'a,d'
</code>
,
<code class="literal">
'd,a'
</code>
,
<code class="literal">
'a,d,d'
</code>
,
<code class="literal">
'a,d,a'
</code>
, and
<code class="literal">
'd,a,d'
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28884946"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> myset <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span>
<span class="token prompt">-></span> <span class="token punctuation">(</span><span class="token string">'a,d'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'d,a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'a,d,a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'a,d,d'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'d,a,d'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 5 rows affected (0.01 sec)</span>
<span class="token output">Records: 5 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
<p>
Then all these values appear as
<code class="literal">
'a,d'
</code>
when
retrieved:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94163394"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> col <span class="token keyword">FROM</span> myset<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> col <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">5 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
If you set a
<code class="literal">
SET
</code>
column to an unsupported
value, the value is ignored and a warning is issued:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60982313"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> myset <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'a,d,d,s'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected, 1 warning (0.03 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1265 <span class="token punctuation">|</span> Data truncated for column 'col' at row 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.04 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> col <span class="token keyword">FROM</span> myset<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> col <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> a,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">6 rows in set (0.01 sec)</span></code></pre>
</div>
<p>
If strict SQL mode is enabled, attempts to insert invalid
<code class="literal">
SET
</code>
values result in an error.
</p>
<p>
<code class="literal">
SET
</code>
values are sorted numerically.
<code class="literal">
NULL
</code>
values sort before
non-
<code class="literal">
NULL
</code>
<code class="literal">
SET
</code>
values.
</p>
<p>
Functions such as
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
that expect a numeric
argument cast the argument to a number if necessary. For
<code class="literal">
SET
</code>
values, the cast operation causes the
numeric value to be used.
</p>
<p>
Normally, you search for
<code class="literal">
SET
</code>
values using the
<a class="link" href="string-functions.html#function_find-in-set">
<code class="literal">
FIND_IN_SET()
</code>
</a>
function or the
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
operator:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15922860"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <span class="token function">FIND_IN_SET</span><span class="token punctuation">(</span><span class="token string">'<em class="replaceable">value</em>'</span><span class="token punctuation">,</span><em class="replaceable">set_col</em><span class="token punctuation">)</span><span class="token operator">></span><span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">set_col</em> <span class="token operator">LIKE</span> <span class="token string">'%<em class="replaceable">value</em>%'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The first statement finds rows where
<em class="replaceable">
<code>
set_col
</code>
</em>
contains the
<em class="replaceable">
<code>
value
</code>
</em>
set member. The second is
similar, but not the same: It finds rows where
<em class="replaceable">
<code>
set_col
</code>
</em>
contains
<em class="replaceable">
<code>
value
</code>
</em>
anywhere, even as a substring
of another set member.
</p>
<p>
The following statements also are permitted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66189434"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">set_col</em> <span class="token operator">&</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">set_col</em> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">val1</em>,<em class="replaceable">val2</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The first of these statements looks for values containing the
first set member. The second looks for an exact match. Be
careful with comparisons of the second type. Comparing set
values to
<code class="literal">
'
<em class="replaceable">
<code>
val1
</code>
</em>
,
<em class="replaceable">
<code>
val2
</code>
</em>
'
</code>
returns different results than comparing values to
<code class="literal">
'
<em class="replaceable">
<code>
val2
</code>
</em>
,
<em class="replaceable">
<code>
val1
</code>
</em>
'
</code>
.
You should specify the values in the same order they are listed
in the column definition.
</p>
<p>
To determine all possible values for a
<code class="literal">
SET
</code>
column, use
<code class="literal">
SHOW COLUMNS FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
LIKE
<em class="replaceable">
<code>
set_col
</code>
</em>
</code>
and parse the
<code class="literal">
SET
</code>
definition in the
<code class="literal">
Type
</code>
column of the output.
</p>
<p>
In the C API,
<code class="literal">
SET
</code>
values are returned as
strings. For information about using result set metadata to
distinguish them from other strings, see
<a class="ulink" href="/doc/c-api/8.4/en/c-api-data-structures.html" target="_top">
C API Basic Data Structures
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/miscellaneous-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="miscellaneous-functions">
</a>
14.23 Miscellaneous Functions
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045191203456">
</a>
<a class="indexterm" name="idm46045191202384">
</a>
<div class="table">
<a name="idm46045191200896">
</a>
<p class="title">
<b>
Table 14.33 Miscellaneous Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists miscellaneous functions.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
</td>
<td>
Suppress ONLY_FULL_GROUP_BY value rejection
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
</td>
<td>
Convert binary UUID to string
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_default">
<code class="literal">
DEFAULT()
</code>
</a>
</td>
<td>
Return the default value for a table column
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
</td>
<td>
Distinguish super-aggregate ROLLUP rows from regular rows
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
</td>
<td>
Return the numeric value of an IP address
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
<code class="literal">
INET_NTOA()
</code>
</a>
</td>
<td>
Return the IP address from a numeric value
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_is-uuid">
<code class="literal">
IS_UUID()
</code>
</a>
</td>
<td>
Whether argument is a valid UUID
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
</td>
<td>
Cause the column to have the given name
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP()
</code>
</a>
</td>
<td>
Sleep for a number of seconds
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
</td>
<td>
Return a Universal Unique Identifier (UUID)
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
</td>
<td>
Return an integer-valued universal identifier
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
</td>
<td>
Convert string UUID to binary
</td>
</tr>
<tr>
<td>
<a class="link" href="miscellaneous-functions.html#function_values">
<code class="literal">
VALUES()
</code>
</a>
</td>
<td>
Define the values to be used during an INSERT
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 548px;">
<thead>
<tr>
<th style="width: 154.641px;">
Name
</th>
<th style="width: 392.156px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_any-value">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE(
<em class="replaceable">
<code>
arg
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045191150304">
</a>
<p>
This function is useful for
<code class="literal">
GROUP BY
</code>
queries when the
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
SQL mode
is enabled, for cases when MySQL rejects a query that you know
is valid for reasons that MySQL cannot determine. The function
return value and type are the same as the return value and
type of its argument, but the function result is not checked
for the
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
SQL mode.
</p>
<p>
For example, if
<code class="literal">
name
</code>
is a nonindexed
column, the following query fails with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42373204"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> address<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1055 (42000)<span class="token punctuation">:</span> Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
</div>
<p>
The failure occurs because
<code class="literal">
address
</code>
is a
nonaggregated column that is neither named among
<code class="literal">
GROUP BY
</code>
columns nor functionally dependent
on them. As a result, the
<code class="literal">
address
</code>
value for
rows within each
<code class="literal">
name
</code>
group is
nondeterministic. There are multiple ways to cause MySQL to
accept the query:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Alter the table to make
<code class="literal">
name
</code>
a primary
key or a unique
<code class="literal">
NOT NULL
</code>
column. This
enables MySQL to determine that
<code class="literal">
address
</code>
is functionally dependent on
<code class="literal">
name
</code>
; that
is,
<code class="literal">
address
</code>
is uniquely determined by
<code class="literal">
name
</code>
. (This technique is inapplicable
if
<code class="literal">
NULL
</code>
must be permitted as a valid
<code class="literal">
name
</code>
value.)
</p>
</li>
<li class="listitem">
<p>
Use
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
to refer to
<code class="literal">
address
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81425803"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span>address<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this case, MySQL ignores the nondeterminism of
<code class="literal">
address
</code>
values within each
<code class="literal">
name
</code>
group and accepts the query. This
may be useful if you simply do not care which value of a
nonaggregated column is chosen for each group.
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
is not an
aggregate function, unlike functions such as
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
. It simply acts to
suppress the test for nondeterminism.
</p>
</li>
<li class="listitem">
<p>
Disable
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
. This
is equivalent to using
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled, as described in the previous item.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
is also useful if
functional dependence exists between columns but MySQL cannot
determine it. The following query is valid because
<code class="literal">
age
</code>
is functionally dependent on the
grouping column
<code class="literal">
age-1
</code>
, but MySQL cannot
tell that and rejects the query with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97202460"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> age <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> age<span class="token number">-1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To cause MySQL to accept the query, use
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31369525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> age<span class="token number">-1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
can be used for
queries that refer to aggregate functions in the absence of a
<code class="literal">
GROUP BY
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37450731"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">ERROR 1140 (42000)<span class="token punctuation">:</span> In aggregated query without GROUP BY, expression
#1 of SELECT list contains nonaggregated column 'mydb.t.name'; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
</div>
<p>
Without
<code class="literal">
GROUP BY
</code>
, there is a single group
and it is nondeterministic which
<code class="literal">
name
</code>
value
to choose for the group.
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
tells MySQL to
accept the query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa55694789"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span></code></pre>
</div>
<p>
It may be that, due to some property of a given data set, you
know that a selected nonaggregated column is effectively
functionally dependent on a
<code class="literal">
GROUP BY
</code>
column. For example, an application may enforce uniqueness of
one column with respect to another. In this case, using
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
for the effectively
functionally dependent column may make sense.
</p>
<p>
For additional discussion, see
<a class="xref" href="group-by-handling.html" title="14.19.3 MySQL Handling of GROUP BY">
Section 14.19.3, “MySQL Handling of GROUP BY”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_bin-to-uuid">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID(
<em class="replaceable">
<code>
binary_uuid
</code>
</em>
)
</code>
</a>
,
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID(
<em class="replaceable">
<code>
binary_uuid
</code>
</em>
,
<em class="replaceable">
<code>
swap_flag
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045191087872">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
is the inverse of
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
. It converts a
binary UUID to a string UUID and returns the result. The
binary value should be a UUID as a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY(16)
</code>
</a>
value. The return
value is a string of five hexadecimal numbers separated by
dashes. (For details about this format, see the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function description.)
If the UUID argument is
<code class="literal">
NULL
</code>
, the return
value is
<code class="literal">
NULL
</code>
. If any argument is invalid,
an error occurs.
</p>
<p>
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
takes one or two
arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The one-argument form takes a binary UUID value. The UUID
value is assumed not to have its time-low and time-high
parts swapped. The string result is in the same order as
the binary argument.
</p>
</li>
<li class="listitem">
<p>
The two-argument form takes a binary UUID value and a
swap-flag value:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
swap_flag
</code>
</em>
is 0, the
two-argument form is equivalent to the one-argument
form. The string result is in the same order as the
binary argument.
</p>
</li>
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
swap_flag
</code>
</em>
is 1, the UUID
value is assumed to have its time-low and time-high
parts swapped. These parts are swapped back to their
original position in the result value.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For usage examples and information about time-part swapping,
see the
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
function
description.
</p>
</li>
<li class="listitem">
<a name="function_default">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_default">
<code class="literal">
DEFAULT(
<em class="replaceable">
<code>
col_name
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045191065328">
</a>
<p>
Returns the default value for a table column. An error results
if the column has no default value.
</p>
<p>
The use of
<a class="link" href="miscellaneous-functions.html#function_default">
<code class="literal">
DEFAULT(
<em class="replaceable">
<code>
col_name
</code>
</em>
)
</code>
</a>
to specify the default value for a named column is permitted
only for columns that have a literal default value, not for
columns that have an expression default value.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53730838"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> i <span class="token operator">=</span> <span class="token function">DEFAULT</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span><span class="token operator">+</span><span class="token number">1</span> <span class="token keyword">WHERE</span> id <span class="token operator"><</span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="string-functions.html#function_format">
<code class="literal">
FORMAT(
<em class="replaceable">
<code>
X
</code>
</em>
,
<em class="replaceable">
<code>
D
</code>
</em>
)
</code>
</a>
</p>
<p>
Formats the number
<em class="replaceable">
<code>
X
</code>
</em>
to a format
like
<code class="literal">
'#,###,###.##'
</code>
, rounded to
<em class="replaceable">
<code>
D
</code>
</em>
decimal places, and returns the
result as a string. For details, see
<a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
Section 14.8, “String Functions and Operators”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_grouping">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING(
<em class="replaceable">
<code>
expr
</code>
</em>
[,
<em class="replaceable">
<code>
expr
</code>
</em>
] ...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045191046032">
</a>
<p>
For
<code class="literal">
GROUP BY
</code>
queries that include a
<code class="literal">
WITH ROLLUP
</code>
modifier, the
<code class="literal">
ROLLUP
</code>
operation produces super-aggregate
output rows where
<code class="literal">
NULL
</code>
represents the set
of all values. The
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
function enables you to distinguish
<code class="literal">
NULL
</code>
values for super-aggregate rows from
<code class="literal">
NULL
</code>
values in regular grouped rows.
</p>
<p>
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
is permitted in the
select list,
<code class="literal">
HAVING
</code>
clause, and
<code class="literal">
ORDER BY
</code>
clause.
</p>
<p>
Each argument to
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
must be an expression that exactly matches an expression in
the
<code class="literal">
GROUP BY
</code>
clause. The expression cannot
be a positional specifier. For each expression,
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
produces 1 if the
expression value in the current row is a
<code class="literal">
NULL
</code>
representing a super-aggregate value.
Otherwise,
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
produces
0, indicating that the expression value is a
<code class="literal">
NULL
</code>
for a regular result row or is not
<code class="literal">
NULL
</code>
.
</p>
<p>
Suppose that table
<code class="literal">
t1
</code>
contains these rows,
where
<code class="literal">
NULL
</code>
indicates something like
<span class="quote">
“
<span class="quote">
other
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
unknown
</span>
”
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50095350"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
A summary of the table without
<code class="literal">
WITH ROLLUP
</code>
looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31622403"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The result contains
<code class="literal">
NULL
</code>
values, but those
do not represent super-aggregate rows because the query does
not include
<code class="literal">
WITH ROLLUP
</code>
.
</p>
<p>
Adding
<code class="literal">
WITH ROLLUP
</code>
produces super-aggregate
summary rows containing additional
<code class="literal">
NULL
</code>
values. However, without comparing this result to the previous
one, it is not easy to see which
<code class="literal">
NULL
</code>
values occur in super-aggregate rows and which occur in
regular grouped rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6613181"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To distinguish
<code class="literal">
NULL
</code>
values in
super-aggregate rows from those in regular grouped rows, use
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
, which returns 1
only for super-aggregate
<code class="literal">
NULL
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26635779"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity<span class="token punctuation">,</span>
<span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_name<span class="token punctuation">,</span>
<span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_size
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span> grp_name <span class="token punctuation">|</span> grp_size <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Common uses for
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Substitute a label for super-aggregate
<code class="literal">
NULL
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69007312"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token function">IF</span><span class="token punctuation">(</span><span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'All items'</span><span class="token punctuation">,</span> <span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">name</span><span class="token punctuation">,</span>
<span class="token function">IF</span><span class="token punctuation">(</span><span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'All sizes'</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token keyword">AS</span> size<span class="token punctuation">,</span>
<span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> All items <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Return only super-aggregate lines by filtering out the
regular grouped lines:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63067655"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
<span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">OR</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
permits multiple
expression arguments. In this case, the
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
return value
represents a bitmask combined from the results for each
expression, where the lowest-order bit corresponds to the
result for the rightmost expression. For example, with three
expression arguments,
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING(
<em class="replaceable">
<code>
expr1
</code>
</em>
,
<em class="replaceable">
<code>
expr2
</code>
</em>
,
<em class="replaceable">
<code>
expr3
</code>
</em>
)
</code>
</a>
is evaluated like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-clike"><div class="docs-select-all right" id="sa70688363"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"> result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr3</em><span class="token punctuation">)</span>
<span class="token operator">+</span> result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr2</em><span class="token punctuation">)</span> <span class="token operator"><</span><span class="token operator"><</span> <span class="token number">1</span>
<span class="token operator">+</span> result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr1</em><span class="token punctuation">)</span> <span class="token operator"><</span><span class="token operator"><</span> <span class="token number">2</span></code></pre>
</div>
<p>
The following query shows how
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
results for single
arguments combine for a multiple-argument call to produce a
bitmask value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89899373"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity<span class="token punctuation">,</span>
<span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_name<span class="token punctuation">,</span>
<span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_size<span class="token punctuation">,</span>
<span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_all
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span> grp_name <span class="token punctuation">|</span> grp_size <span class="token punctuation">|</span> grp_all <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
With multiple expression arguments, the
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
return value is
nonzero if any expression represents a super-aggregate value.
Multiple-argument
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
syntax thus provides a simpler way to write the earlier query
that returned only super-aggregate rows, by using a single
multiple-argument
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
call rather than multiple single-argument calls:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13367325"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
<span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token operator"><></span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 58 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Use of
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
is subject to
these limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Do not use subquery
<code class="literal">
GROUP BY
</code>
expressions as
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
arguments because matching might fail. For example,
matching fails for this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20357489"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> t1
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">)</span> <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3580 (HY000)<span class="token punctuation">:</span> Argument #1 of GROUPING function is not in GROUP BY</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
GROUP BY
</code>
literal expressions should not
be used within a
<code class="literal">
HAVING
</code>
clause as
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
arguments. Due
to differences between when the optimizer evaluates
<code class="literal">
GROUP BY
</code>
and
<code class="literal">
HAVING
</code>
,
matching may succeed but
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
evaluation does
not produce the expected result. Consider this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57246894"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> a <span class="token keyword">AS</span> f1<span class="token punctuation">,</span> <span class="token string">'w'</span> <span class="token keyword">AS</span> f2
<span class="token keyword">FROM</span> t
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> f1<span class="token punctuation">,</span> f2 <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
<span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span>f2<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
is evaluated
earlier for the literal constant expression than for the
<code class="literal">
HAVING
</code>
clause as a whole and returns 0.
To check whether a query such as this is affected, use
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
and look for
<code class="literal">
Impossible having
</code>
in the
<code class="literal">
Extra
</code>
column.
</p>
</li>
</ul>
</div>
<p>
For more information about
<code class="literal">
WITH ROLLUP
</code>
and
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
, see
<a class="xref" href="group-by-modifiers.html" title="14.19.2 GROUP BY Modifiers">
Section 14.19.2, “GROUP BY Modifiers”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_inet-aton">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190933104">
</a>
<p>
Given the dotted-quad representation of an IPv4 network
address as a string, returns an integer that represents the
numeric value of the address in network byte order (big
endian).
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
returns
<code class="literal">
NULL
</code>
if it does not understand its
argument, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8962211"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">167773449</span></code></pre>
</div>
<p>
For this example, the return value is calculated as
10×256
<sup>
3
</sup>
+
0×256
<sup>
2
</sup>
+ 5×256 + 9.
</p>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
may or may not
return a non-
<code class="literal">
NULL
</code>
result for short-form IP
addresses (such as
<code class="literal">
'127.1'
</code>
as a
representation of
<code class="literal">
'127.0.0.1'
</code>
). Because of
this,
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
a should not
be used for such addresses.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
To store values generated by
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
, use an
<code class="literal">
INT UNSIGNED
</code>
column rather than
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INT
</code>
</a>
, which is signed. If you
use a signed column, values corresponding to IP addresses
for which the first octet is greater than 127 cannot be
stored correctly. See
<a class="xref" href="out-of-range-and-overflow.html" title="13.1.7 Out-of-Range and Overflow Handling">
Section 13.1.7, “Out-of-Range and Overflow Handling”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<a name="function_inet-ntoa">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
<code class="literal">
INET_NTOA(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190908144">
</a>
<p>
Given a numeric IPv4 network address in network byte order,
returns the dotted-quad string representation of the address
as a string in the connection character set.
<a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
<code class="literal">
INET_NTOA()
</code>
</a>
returns
<code class="literal">
NULL
</code>
if it does not understand its
argument.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50439609"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET_NTOA</span><span class="token punctuation">(</span><span class="token number">167773449</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'10.0.5.9'</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_inet6-aton">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190895840">
</a>
<p>
Given an IPv6 or IPv4 network address as a string, returns a
binary string that represents the numeric value of the address
in network byte order (big endian). Because numeric-format
IPv6 addresses require more bytes than the largest integer
type, the representation returned by this function has the
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
data type:
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY(16)
</code>
</a>
for IPv6
addresses and
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY(4)
</code>
</a>
for
IPv4 addresses. If the argument is not a valid address, or if
it is
<code class="literal">
NULL
</code>
,
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
The following examples use
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
to display the
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
result in
printable form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42250371"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'fdfe::5a55:caff:fefa:9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'FDFE0000000000005A55CAFFFEFA9089'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'0A000509'</span></code></pre>
</div>
<p>
<code class="literal">
INET6_ATON()
</code>
observes several constraints
on valid arguments. These are given in the following list
along with examples.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A trailing zone ID is not permitted, as in
<code class="literal">
fe80::3%1
</code>
or
<code class="literal">
fe80::3%eth0
</code>
.
</p>
</li>
<li class="listitem">
<p>
A trailing network mask is not permitted, as in
<code class="literal">
2001:45f:3:ba::/64
</code>
or
<code class="literal">
198.51.100.0/24
</code>
.
</p>
</li>
<li class="listitem">
<p>
For values representing IPv4 addresses, only classless
addresses are supported. Classful addresses such as
<code class="literal">
198.51.1
</code>
are rejected. A trailing port
number is not permitted, as in
<code class="literal">
198.51.100.2:8080
</code>
. Hexadecimal numbers
in address components are not permitted, as in
<code class="literal">
198.0xa0.1.2
</code>
. Octal numbers are not
supported:
<code class="literal">
198.51.010.1
</code>
is treated as
<code class="literal">
198.51.10.1
</code>
, not
<code class="literal">
198.51.8.1
</code>
. These IPv4 constraints also
apply to IPv6 addresses that have IPv4 address parts, such
as IPv4-compatible or IPv4-mapped addresses.
</p>
</li>
</ul>
</div>
<p>
To convert an IPv4 address
<em class="replaceable">
<code>
expr
</code>
</em>
represented in numeric form as an
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INT
</code>
</a>
value to an IPv6 address
represented in numeric form as a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
value, use this
expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47716196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token function">INET_NTOA</span><span class="token punctuation">(</span><em class="replaceable">expr</em><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5946371"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token function">INET_NTOA</span><span class="token punctuation">(</span><span class="token number">167773449</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'0A000509'</span></code></pre>
</div>
<p>
If
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary strings
display using hexadecimal notation, depending on the value of
the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_inet6-ntoa">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
<code class="literal">
INET6_NTOA(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190851648">
</a>
<p>
Given an IPv6 or IPv4 network address represented in numeric
form as a binary string, returns the string representation of
the address as a string in the connection character set. If
the argument is not a valid address, or if it is
<code class="literal">
NULL
</code>
,
<a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
<code class="literal">
INET6_NTOA()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
<a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
<code class="literal">
INET6_NTOA()
</code>
</a>
has these
properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
It does not use operating system functions to perform
conversions, thus the output string is platform
independent.
</p>
</li>
<li class="listitem">
<p>
The return string has a maximum length of 39 (4 x 8 + 7).
Given this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81825717"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><em class="replaceable">expr</em><span class="token punctuation">)</span> <span class="token keyword">AS</span> c1<span class="token punctuation">;</span></code></pre>
</div>
<p>
The resulting table would have this definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa90311280"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">39</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb3 <span class="token keyword">DEFAULT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
The return string uses lowercase letters for IPv6
addresses.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88516329"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'fdfe::5a55:caff:fefa:9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'fdfe::5a55:caff:fefa:9089'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'10.0.5.9'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'FDFE0000000000005A55CAFFFEFA9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'fdfe::5a55:caff:fefa:9089'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'0A000509'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'10.0.5.9'</span></code></pre>
</div>
<p>
If
<a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
<code class="literal">
INET6_NTOA()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary strings
display using hexadecimal notation, depending on the value of
the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_is-ipv4">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_is-ipv4">
<code class="literal">
IS_IPV4(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190823536">
</a>
<p>
Returns 1 if the argument is a valid IPv4 address specified as
a string, 0 otherwise. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95792198"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">IS_IPV4</span><span class="token punctuation">(</span><span class="token string">'10.0.5.256'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span></code></pre>
</div>
<p>
For a given argument, if
<a class="link" href="miscellaneous-functions.html#function_is-ipv4">
<code class="literal">
IS_IPV4()
</code>
</a>
returns 1,
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
(and
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
) returns
non-
<code class="literal">
NULL
</code>
. The converse statement is not
true: In some cases,
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
returns
non-
<code class="literal">
NULL
</code>
when
<a class="link" href="miscellaneous-functions.html#function_is-ipv4">
<code class="literal">
IS_IPV4()
</code>
</a>
returns 0.
</p>
<p>
As implied by the preceding remarks,
<a class="link" href="miscellaneous-functions.html#function_is-ipv4">
<code class="literal">
IS_IPV4()
</code>
</a>
is more strict than
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
about what
constitutes a valid IPv4 address, so it may be useful for
applications that need to perform strong checks against
invalid values. Alternatively, use
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
to convert IPv4
addresses to internal form and check for a
<code class="literal">
NULL
</code>
result (which indicates an invalid
address).
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
is
equally strong as
<a class="link" href="miscellaneous-functions.html#function_is-ipv4">
<code class="literal">
IS_IPV4()
</code>
</a>
about checking IPv4 addresses.
</p>
</li>
<li class="listitem">
<a name="function_is-ipv4-compat">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_is-ipv4-compat">
<code class="literal">
IS_IPV4_COMPAT(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190795408">
</a>
<p>
This function takes an IPv6 address represented in numeric
form as a binary string, as returned by
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
. It returns 1 if
the argument is a valid IPv4-compatible IPv6 address, 0
otherwise (unless
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
, in which case the function returns
<code class="literal">
NULL
</code>
). IPv4-compatible addresses have the
form
<code class="literal">
::
<em class="replaceable">
<code>
ipv4_address
</code>
</em>
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16986385"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
The IPv4 part of an IPv4-compatible address can also be
represented using hexadecimal notation. For example,
<code class="literal">
198.51.100.1
</code>
has this raw hexadecimal
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4869400"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'C6336401'</span></code></pre>
</div>
<p>
Expressed in IPv4-compatible form,
<code class="literal">
::198.51.100.1
</code>
is equivalent to
<code class="literal">
::c0a8:0001
</code>
or (without leading zeros)
<code class="literal">
::c0a8:1
</code>
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36716813"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::c0a8:0001'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::c0a8:1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_is-ipv4-mapped">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_is-ipv4-mapped">
<code class="literal">
IS_IPV4_MAPPED(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190770480">
</a>
<p>
This function takes an IPv6 address represented in numeric
form as a binary string, as returned by
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
. It returns 1 if
the argument is a valid IPv4-mapped IPv6 address, 0 otherwise,
unless
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
, in which case the function returns
<code class="literal">
NULL
</code>
. IPv4-mapped addresses have the form
<code class="literal">
::ffff:
<em class="replaceable">
<code>
ipv4_address
</code>
</em>
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65108168"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
As with
<code class="literal">
IS_IPV4_COMPAT()
</code>
the IPv4 part of
an IPv4-mapped address can also be represented using
hexadecimal notation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19102107"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:c0a8:0001'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:c0a8:1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_is-ipv6">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_is-ipv6">
<code class="literal">
IS_IPV6(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190749872">
</a>
<p>
Returns 1 if the argument is a valid IPv6 address specified as
a string, 0 otherwise, unless
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
, in which case the function returns
<code class="literal">
NULL
</code>
. This function does not consider IPv4
addresses to be valid IPv6 addresses.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53246965"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV6</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">IS_IPV6</span><span class="token punctuation">(</span><span class="token string">'::1'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
<p>
For a given argument, if
<a class="link" href="miscellaneous-functions.html#function_is-ipv6">
<code class="literal">
IS_IPV6()
</code>
</a>
returns 1,
<a class="link" href="miscellaneous-functions.html#function_inet6-aton">
<code class="literal">
INET6_ATON()
</code>
</a>
returns
non-
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_is-uuid">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_is-uuid">
<code class="literal">
IS_UUID(
<em class="replaceable">
<code>
string_uuid
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190734016">
</a>
<p>
Returns 1 if the argument is a valid string-format UUID, 0 if
the argument is not a valid UUID, and
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
.
</p>
<p>
<span class="quote">
“
<span class="quote">
Valid
</span>
”
</span>
means that the value is in a format that
can be parsed. That is, it has the correct length and contains
only the permitted characters (hexadecimal digits in any
lettercase and, optionally, dashes and curly braces). This
format is most common:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa23724527"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</code></pre>
</div>
<p>
These other formats are also permitted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa13600500"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">aaaaaaaabbbbccccddddeeeeeeeeeeee
{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}</code></pre>
</div>
<p>
For the meanings of fields within the value, see the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function description.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8433069"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID('6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6CCD780C-BABA-1026-9564-5B8C656024DB'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID('6CCD780C<span class="token punctuation">-</span>BABA<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5B8C656024DB') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780cbaba102695645b8c656024db'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID('6ccd780cbaba102695645b8c656024db') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'{6ccd780c-baba-1026-9564-5b8c656024db}'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID('{6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db}') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780c-baba-1026-9564-5b8c6560'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID('6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c6560') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IS_UUID</span><span class="token punctuation">(</span><span class="token function">RAND</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> IS_UUID(RAND()) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_name-const">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST(
<em class="replaceable">
<code>
name
</code>
</em>
,
<em class="replaceable">
<code>
value
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190710784">
</a>
<p>
Returns the given value. When used to produce a result set
column,
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
causes the
column to have the given name. The arguments should be
constants.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29241425"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">NAME_CONST</span><span class="token punctuation">(</span><span class="token string">'myname'</span><span class="token punctuation">,</span> <span class="token number">14</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> myname <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
This function is for internal use only. The server uses it
when writing statements from stored programs that contain
references to local program variables, as described in
<a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
Section 27.7, “Stored Program Binary Logging”
</a>
. You might see this
function in the output from
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
.
</p>
<p>
For your applications, you can obtain exactly the same result
as in the example just shown by using simple aliasing, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83253391"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">14</span> <span class="token keyword">AS</span> myname<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> myname <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
See
<a class="xref" href="select.html" title="15.2.13 SELECT Statement">
Section 15.2.13, “SELECT Statement”
</a>
, for more information about
column aliases.
</p>
</li>
<li class="listitem">
<a name="function_sleep">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP(
<em class="replaceable">
<code>
duration
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190693776">
</a>
<p>
Sleeps (pauses) for the number of seconds given by the
<em class="replaceable">
<code>
duration
</code>
</em>
argument, then returns 0.
The duration may have a fractional part. If the argument is
<code class="literal">
NULL
</code>
or negative,
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP()
</code>
</a>
produces a warning, or
an error in strict SQL mode.
</p>
<p>
When sleep returns normally (without interruption), it returns
0:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42266452"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
When
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP()
</code>
</a>
is the only thing
invoked by a query that is interrupted, it returns 1 and the
query itself returns no error. This is true whether the query
is killed or times out:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
This statement is interrupted using
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL QUERY
</code>
</a>
from another session:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65639593"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
This statement is interrupted by timing out:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68270748"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token comment" spellcheck="true">/*+ MAX_EXECUTION_TIME(1) */</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ul>
</div>
<p>
When
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP()
</code>
</a>
is only part of a
query that is interrupted, the query returns an error:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
This statement is interrupted using
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL QUERY
</code>
</a>
from another session:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54710479"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1317 (70100)<span class="token punctuation">:</span> Query execution was interrupted</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
This statement is interrupted by timing out:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58120200"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token comment" spellcheck="true">/*+ MAX_EXECUTION_TIME(1000) */</span> <span class="token number">1</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3024 (HY000)<span class="token punctuation">:</span> Query execution was interrupted, maximum statement
execution time exceeded</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
This function is unsafe for statement-based replication. A
warning is logged if you use this function when
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
is set to
<code class="literal">
STATEMENT
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_uuid">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
</p>
<a class="indexterm" name="idm46045190661728">
</a>
<p>
Returns a Universal Unique Identifier (UUID) generated
according to RFC 4122,
<span class="quote">
“
<span class="quote">
A Universally Unique IDentifier
(UUID) URN Namespace
</span>
”
</span>
(
<a class="ulink" href="http://www.ietf.org/rfc/rfc4122.txt" target="_blank">
http://www.ietf.org/rfc/rfc4122.txt
</a>
).
</p>
<p>
A UUID is designed as a number that is globally unique in
space and time. Two calls to
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
are expected to generate
two different values, even if these calls are performed on two
separate devices not connected to each other.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Although
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
values are
intended to be unique, they are not necessarily unguessable
or unpredictable. If unpredictability is required, UUID
values should be generated some other way.
</p>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
returns a value that
conforms to UUID version 1 as described in RFC 4122. The value
is a 128-bit number represented as a
<code class="literal">
utf8mb3
</code>
string of five hexadecimal numbers
in
<code class="literal">
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
</code>
format:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The first three numbers are generated from the low,
middle, and high parts of a timestamp. The high part also
includes the UUID version number.
</p>
</li>
<li class="listitem">
<p>
The fourth number preserves temporal uniqueness in case
the timestamp value loses monotonicity (for example, due
to daylight saving time).
</p>
</li>
<li class="listitem">
<p>
The fifth number is an IEEE 802 node number that provides
spatial uniqueness. A random number is substituted if the
latter is not available (for example, because the host
device has no Ethernet card, or it is unknown how to find
the hardware address of an interface on the host operating
system). In this case, spatial uniqueness cannot be
guaranteed. Nevertheless, a collision should have
<span class="emphasis">
<em>
very
</em>
</span>
low probability.
</p>
<p>
The MAC address of an interface is taken into account only
on FreeBSD, Linux, and Windows. On other operating
systems, MySQL uses a randomly generated 48-bit number.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18387953"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span></code></pre>
</div>
<p>
To convert between string and binary UUID values, use the
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
and
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
functions. To
check whether a string is a valid UUID value, use the
<a class="link" href="miscellaneous-functions.html#function_is-uuid">
<code class="literal">
IS_UUID()
</code>
</a>
function.
</p>
<p>
This function is unsafe for statement-based replication. A
warning is logged if you use this function when
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
is set to
<code class="literal">
STATEMENT
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_uuid-short">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
</p>
<a class="indexterm" name="idm46045190631424">
</a>
<p>
Returns a
<span class="quote">
“
<span class="quote">
short
</span>
”
</span>
universal identifier as a
64-bit unsigned integer. Values returned by
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
differ from the
string-format 128-bit identifiers returned by the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function and have
different uniqueness properties. The value of
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
is guaranteed to
be unique if the following conditions hold:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="replication-options.html#sysvar_server_id">
<code class="literal">
server_id
</code>
</a>
value of
the current server is between 0 and 255 and is unique
among your set of source and replica servers
</p>
</li>
<li class="listitem">
<p>
You do not set back the system time for your server host
between
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
restarts
</p>
</li>
<li class="listitem">
<p>
You invoke
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
on
average fewer than 16 million times per second between
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
restarts
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
return value
is constructed this way:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-clike"><div class="docs-select-all right" id="sa4558393"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"> <span class="token punctuation">(</span>server_id <span class="token operator">&</span> <span class="token number">255</span><span class="token punctuation">)</span> <span class="token operator"><</span><span class="token operator"><</span> <span class="token number">56</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>server_startup_time_in_seconds <span class="token operator"><</span><span class="token operator"><</span> <span class="token number">24</span><span class="token punctuation">)</span>
<span class="token operator">+</span> incremented_variable<span class="token operator">++</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46978848"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UUID_SHORT</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">92395783831158784</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
does not work
with statement-based replication.
</p>
</div>
</li>
<li class="listitem">
<a name="function_uuid-to-bin">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN(
<em class="replaceable">
<code>
string_uuid
</code>
</em>
)
</code>
</a>
,
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN(
<em class="replaceable">
<code>
string_uuid
</code>
</em>
,
<em class="replaceable">
<code>
swap_flag
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190601936">
</a>
<p>
Converts a string UUID to a binary UUID and returns the
result. (The
<a class="link" href="miscellaneous-functions.html#function_is-uuid">
<code class="literal">
IS_UUID()
</code>
</a>
function
description lists the permitted string UUID formats.) The
return binary UUID is a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY(16)
</code>
</a>
value. If the
UUID argument is
<code class="literal">
NULL
</code>
, the return value is
<code class="literal">
NULL
</code>
. If any argument is invalid, an error
occurs.
</p>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
takes one or two
arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The one-argument form takes a string UUID value. The
binary result is in the same order as the string argument.
</p>
</li>
<li class="listitem">
<p>
The two-argument form takes a string UUID value and a flag
value:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
swap_flag
</code>
</em>
is 0, the
two-argument form is equivalent to the one-argument
form. The binary result is in the same order as the
string argument.
</p>
</li>
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
swap_flag
</code>
</em>
is 1, the
format of the return value differs: The time-low and
time-high parts (the first and third groups of
hexadecimal digits, respectively) are swapped. This
moves the more rapidly varying part to the right and
can improve indexing efficiency if the result is
stored in an indexed column.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
Time-part swapping assumes the use of UUID version 1 values,
such as are generated by the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function. For UUID
values produced by other means that do not follow version 1
format, time-part swapping provides no benefit. For details
about version 1 format, see the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function description.
</p>
<p>
Suppose that you have the following string UUID value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63649367"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@uuid</span> <span class="token operator">=</span> <span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To convert the string UUID to binary with or without time-part
swapping, use
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7727907"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA102695645B8C656024DB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid, 0)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA102695645B8C656024DB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid, 1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1026BABA6CCD780C95645B8C656024DB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To convert a binary UUID returned by
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
to a string UUID,
use
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
. If you
produce a binary UUID by calling
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
with a second
argument of 1 to swap time parts, you should also pass a
second argument of 1 to
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
to unswap the
time parts when converting the binary UUID back to a string
UUID:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18968839"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIN_TO_UUID(UUID_TO_BIN(@uuid)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIN_TO_UUID(UUID_TO_BIN(@uuid,0),0) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIN_TO_UUID(UUID_TO_BIN(@uuid,1),1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If the use of time-part swapping is not the same for the
conversion in both directions, the original UUID is not
recovered properly:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92936752"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIN_TO_UUID(UUID_TO_BIN(@uuid,0),1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> baba1026<span class="token punctuation">-</span>780c<span class="token punctuation">-</span>6ccd<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIN_TO_UUID(UUID_TO_BIN(@uuid,1),0) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1026baba<span class="token punctuation">-</span>6ccd<span class="token punctuation">-</span>780c<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
is invoked
from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary
strings display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_values">
</a>
<p>
<a class="link" href="miscellaneous-functions.html#function_values">
<code class="literal">
VALUES(
<em class="replaceable">
<code>
col_name
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045190553200">
</a>
<p>
In an
<a class="link" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
<code class="literal">
INSERT
... ON DUPLICATE KEY UPDATE
</code>
</a>
statement, you can use
the
<code class="literal">
VALUES(
<em class="replaceable">
<code>
col_name
</code>
</em>
)
</code>
function in the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
clause
to refer to column values from the
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
portion of the
statement. In other words,
<code class="literal">
VALUES(
<em class="replaceable">
<code>
col_name
</code>
</em>
)
</code>
in the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
clause refers to
the value of
<em class="replaceable">
<code>
col_name
</code>
</em>
that would be
inserted, had no duplicate-key conflict occurred. This
function is especially useful in multiple-row inserts. The
<a class="link" href="miscellaneous-functions.html#function_values">
<code class="literal">
VALUES()
</code>
</a>
function is meaningful
only in the
<code class="literal">
ON DUPLICATE KEY UPDATE
</code>
clause
of
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements and
returns
<code class="literal">
NULL
</code>
otherwise. See
<a class="xref" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
Section 15.2.7.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76046886"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> <span class="token keyword">table</span> <span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">,</span>c<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">ON</span> <span class="token keyword">DUPLICATE</span> <span class="token keyword">KEY</span> <span class="token keyword">UPDATE</span> c<span class="token operator">=</span><span class="token keyword">VALUES</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token operator">+</span><span class="token keyword">VALUES</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
This usage is deprecated, and subject to removal in a future
release of MySQL. Use a row alias, or row and column
aliases, instead. For more information and examples, see
<a class="xref" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
Section 15.2.7.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”
</a>
.
</p>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-instrument-filtering.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-instrument-filtering">
</a>
29.4.4 Pre-Filtering by Instrument
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table lists
the available instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94045007"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">NAME</span><span class="token punctuation">,</span> ENABLED<span class="token punctuation">,</span> TIMED
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/end <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/executing <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/init <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/insert <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> statement/sql/load <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> statement/sql/grant <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> statement/sql/check <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> statement/sql/flush <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_global_read_lock <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_global_system_variables <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_lock_db <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/sql/LOCK_manager <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/rwlock/sql/LOCK_grant <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/rwlock/sql/LOGGER::LOCK_logger <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/rwlock/sql/LOCK_sys_init_connect <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/rwlock/sql/LOCK_sys_init_slave <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/binlog <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/binlog_index <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/casetest <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/sql/dbopt <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
To control whether an instrument is enabled, set its
<code class="literal">
ENABLED
</code>
column to
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
. To configure whether to collect timing
information for an enabled instrument, set its
<code class="literal">
TIMED
</code>
value to
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
. Setting the
<code class="literal">
TIMED
</code>
column affects Performance Schema table contents as described in
<a class="xref" href="performance-schema-timing.html" title="29.4.1 Performance Schema Event Timing">
Section 29.4.1, “Performance Schema Event Timing”
</a>
.
</p>
<p>
Modifications to most
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
rows affect
monitoring immediately. For some instruments, modifications are
effective only at server startup; changing them at runtime has
no effect. This affects primarily mutexes, conditions, and
rwlocks in the server, although there may be other instruments
for which this is true.
</p>
<p>
The
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table
provides the most basic form of control over event production.
To further refine event production based on the type of object
or thread being monitored, other tables may be used as described
in
<a class="xref" href="performance-schema-pre-filtering.html" title="29.4.3 Event Pre-Filtering">
Section 29.4.3, “Event Pre-Filtering”
</a>
.
</p>
<p>
The following examples demonstrate possible operations on the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table. These
changes, like other pre-filtering operations, affect all users.
Some of these queries use the
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
operator and a pattern match instrument names. For additional
information about specifying patterns to select instruments, see
<a class="xref" href="performance-schema-filtering-names.html" title="29.4.9 Naming Instruments or Consumers for Filtering Operations">
Section 29.4.9, “Naming Instruments or Consumers for Filtering Operations”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Disable all instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3525168"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now no events are collected.
</p>
</li>
<li class="listitem">
<p>
Disable all file instruments, adding them to the current set
of disabled instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67835323"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'wait/io/file/%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Disable only file instruments, enable all other instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3659901"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'wait/io/file/%'</span><span class="token punctuation">,</span> <span class="token string">'NO'</span><span class="token punctuation">,</span> <span class="token string">'YES'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Enable all but those instruments in the
<code class="literal">
mysys
</code>
library:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96152620"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token operator">CASE</span> <span class="token keyword">WHEN</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%/mysys/%'</span> <span class="token keyword">THEN</span> <span class="token string">'YES'</span> <span class="token keyword">ELSE</span> <span class="token string">'NO'</span> <span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Disable a specific instrument:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62820809"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'wait/synch/mutex/mysys/TMPDIR_mutex'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To toggle the state of an instrument,
<span class="quote">
“
<span class="quote">
flip
</span>
”
</span>
its
<code class="literal">
ENABLED
</code>
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99517878"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token function">IF</span><span class="token punctuation">(</span>ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">,</span> <span class="token string">'NO'</span><span class="token punctuation">,</span> <span class="token string">'YES'</span><span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'wait/synch/mutex/mysys/TMPDIR_mutex'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Disable timing for all events:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73404693"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> TIMED <span class="token operator">=</span> <span class="token string">'NO'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-solutions-backups-read-only.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-solutions-backups-read-only">
</a>
19.4.1.3 Backing Up a Source or Replica by Making It Read Only
</h4>
</div>
</div>
</div>
<p>
It is possible to back up either source or replica servers in a
replication setup by acquiring a global read lock and
manipulating the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
system variable to change the read-only state of the server to
be backed up:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Make the server read-only, so that it processes only
retrievals and blocks updates.
</p>
</li>
<li class="listitem">
<p>
Perform the backup.
</p>
</li>
<li class="listitem">
<p>
Change the server back to its normal read/write state.
</p>
</li>
</ol>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The instructions in this section place the server to be backed
up in a state that is safe for backup methods that get the
data from the server, such as
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
(see
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
). You should not attempt to
use these instructions to make a binary backup by copying
files directly because the server may still have modified data
cached in memory and not flushed to disk.
</p>
</div>
<p>
The following instructions describe how to do this for a source
and for a replica. For both scenarios discussed here, suppose
that you have the following replication setup:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A source server S1
</p>
</li>
<li class="listitem">
<p>
A replica server R1 that has S1 as its source
</p>
</li>
<li class="listitem">
<p>
A client C1 connected to S1
</p>
</li>
<li class="listitem">
<p>
A client C2 connected to R1
</p>
</li>
</ul>
</div>
<p>
In either scenario, the statements to acquire the global read
lock and manipulate the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
variable are
performed on the server to be backed up and do not propagate to
any replicas of that server.
</p>
<p>
<span class="bold">
<strong>
Scenario 1: Backup with a Read-Only
Source
</strong>
</span>
</p>
<p>
Put the source S1 in a read-only state by executing these
statements on it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36311640"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> <span class="token keyword">WITH</span> <span class="token keyword">READ</span> <span class="token keyword">LOCK</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">read_only</span> <span class="token operator">=</span> <span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
While S1 is in a read-only state, the following properties are
true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Requests for updates sent by C1 to S1 block because the
server is in read-only mode.
</p>
</li>
<li class="listitem">
<p>
Requests for query results sent by C1 to S1 succeed.
</p>
</li>
<li class="listitem">
<p>
Making a backup on S1 is safe.
</p>
</li>
<li class="listitem">
<p>
Making a backup on R1 is not safe. This server is still
running, and might be processing the binary log or update
requests coming from client C2.
</p>
</li>
</ul>
</div>
<p>
While S1 is read only, perform the backup. For example, you can
use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
.
</p>
<p>
After the backup operation on S1 completes, restore S1 to its
normal operational state by executing these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71916111"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">read_only</span> <span class="token operator">=</span> <span class="token keyword">OFF</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Although performing the backup on S1 is safe (as far as the
backup is concerned), it is not optimal for performance because
clients of S1 are blocked from executing updates.
</p>
<p>
This strategy applies to backing up a source in a replication
setup, but can also be used for a single server in a
nonreplication setting.
</p>
<p>
<span class="bold">
<strong>
Scenario 2: Backup with a Read-Only
Replica
</strong>
</span>
</p>
<p>
Put the replica R1 in a read-only state by executing these
statements on it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1306950"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> <span class="token keyword">WITH</span> <span class="token keyword">READ</span> <span class="token keyword">LOCK</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">read_only</span> <span class="token operator">=</span> <span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
While R1 is in a read-only state, the following properties are
true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The source S1 continues to operate, so making a backup on
the source is not safe.
</p>
</li>
<li class="listitem">
<p>
The replica R1 is stopped, so making a backup on the replica
R1 is safe.
</p>
</li>
</ul>
</div>
<p>
These properties provide the basis for a popular backup
scenario: Having one replica busy performing a backup for a
while is not a problem because it does not affect the entire
network, and the system is still running during the backup. In
particular, clients can still perform updates on the source
server, which remains unaffected by backup activity on the
replica.
</p>
<p>
While R1 is read only, perform the backup. For example, you can
use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
.
</p>
<p>
After the backup operation on R1 completes, restore R1 to its
normal operational state by executing these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45052324"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">read_only</span> <span class="token operator">=</span> <span class="token keyword">OFF</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
After the replica is restored to normal operation, it again
synchronizes to the source by catching up with any outstanding
updates from the source's binary log.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-replication-applier-global-filters-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-replication-applier-global-filters-table">
</a>
29.12.11.4 The replication_applier_global_filters Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045071497632">
</a>
<a class="indexterm" name="idm46045071496128">
</a>
<p>
This table shows the global replication filters configured on
this replica. The
<code class="literal">
replication_applier_global_filters
</code>
table
has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
FILTER_NAME
</code>
</p>
<p>
The type of replication filter that has been configured.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FILTER_RULE
</code>
</p>
<p>
The rules configured for the replication filter type using
either
<code class="option">
--replicate-*
</code>
command options or
<a class="link" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
<code class="literal">
CHANGE REPLICATION FILTER
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CONFIGURED_BY
</code>
</p>
<p>
The method used to configure the replication filter, can
be one of:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
CHANGE_REPLICATION_FILTER
</code>
configured by a global replication filter using a
<a class="link" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
<code class="literal">
CHANGE REPLICATION
FILTER
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STARTUP_OPTIONS
</code>
configured by a
global replication filter using a
<code class="option">
--replicate-*
</code>
option.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
ACTIVE_SINCE
</code>
</p>
<p>
Timestamp of when the replication filter was configured.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replica-logs.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replica-logs">
</a>
19.2.4 Relay Log and Replication Metadata Repositories
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="replica-logs-relaylog.html">
19.2.4.1 The Relay Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-logs-status.html">
19.2.4.2 Replication Metadata Repositories
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045137975408">
</a>
<a class="indexterm" name="idm46045137973952">
</a>
<a class="indexterm" name="idm46045137972448">
</a>
<a class="indexterm" name="idm46045137971376">
</a>
<a class="indexterm" name="idm46045137970288">
</a>
<a class="indexterm" name="idm46045137969200">
</a>
<a class="indexterm" name="idm46045137968112">
</a>
<p>
A replica server creates several repositories of information to
use for the replication process:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The replica's
<span class="emphasis">
<em>
relay log
</em>
</span>
, which is written
by the replication I/O (receiver) thread, contains the
transactions read from the replication source server's binary
log. The transactions in the relay log are applied on the
replica by the replication SQL (applier) thread. For
information about the relay log, see
<a class="xref" href="replica-logs-relaylog.html" title="19.2.4.1 The Relay Log">
Section 19.2.4.1, “The Relay Log”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The replica's
<span class="emphasis">
<em>
connection metadata
repository
</em>
</span>
contains information that the
replication receiver thread needs to connect to the
replication source server and retrieve transactions from the
source's binary log. The connection metadata repository is
written to the
<code class="literal">
mysql.slave_master_info
</code>
table.
</p>
</li>
<li class="listitem">
<p>
The replica's
<span class="emphasis">
<em>
applier metadata repository
</em>
</span>
contains information that the replication applier thread needs
to read and apply transactions from the replica's relay log.
The applier metadata repository is written to the
<code class="literal">
mysql.slave_relay_log_info
</code>
table.
</p>
</li>
</ul>
</div>
<p>
The replica's connection metadata repository and applier metadata
repository are collectively known as the replication metadata
repositories. For information about these, see
<a class="xref" href="replica-logs-status.html" title="19.2.4.2 Replication Metadata Repositories">
Section 19.2.4.2, “Replication Metadata Repositories”
</a>
.
</p>
<p>
<a name="replication-implementation-crash-safe">
</a>
<b>
Making replication resilient to unexpected halts.
</b>
The
<code class="literal">
mysql.slave_master_info
</code>
and
<code class="literal">
mysql.slave_relay_log_info
</code>
tables are created
using the transactional storage engine
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
. Updates to the replica's
applier metadata repository table are committed together with
the transactions, meaning that the replica's progress
information recorded in that repository is always consistent
with what has been applied to the database, even in the event of
an unexpected server halt. For information on the combination of
settings on the replica that is most resilient to unexpected
halts, see
<a class="xref" href="replication-solutions-unexpected-replica-halt.html" title="19.4.2 Handling an Unexpected Halt of a Replica">
Section 19.4.2, “Handling an Unexpected Halt of a Replica”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-thread-pool.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-enterprise-thread-pool">
</a>
32.6 MySQL Enterprise Thread Pool Overview
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060200240">
</a>
<a class="indexterm" name="idm46045060199152">
</a>
<p>
MySQL Enterprise Edition includes MySQL Enterprise Thread Pool, implemented using a server plugin. The
default thread-handling model in MySQL Server executes statements
using one thread per client connection. As more clients connect to
the server and execute statements, overall performance degrades.
In MySQL Enterprise Edition, a thread pool plugin provides an alternative
thread-handling model designed to reduce overhead and improve
performance. The plugin implements a thread pool that increases
server performance by efficiently managing statement execution
threads for large numbers of client connections.
</p>
<p>
For more information, see
<a class="xref" href="thread-pool.html" title="7.6.3 MySQL Enterprise Thread Pool">
Section 7.6.3, “MySQL Enterprise Thread Pool”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqldump-sql-format.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysqldump-sql-format">
</a>
9.4.1 Dumping Data in SQL Format with mysqldump
</h3>
</div>
</div>
</div>
<p>
This section describes how to use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
to create SQL-format dump files. For information about reloading
such dump files, see
<a class="xref" href="reloading-sql-format-dumps.html" title="9.4.2 Reloading SQL-Format Backups">
Section 9.4.2, “Reloading SQL-Format Backups”
</a>
.
</p>
<p>
By default,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
writes information as
SQL statements to the standard output. You can save the output
in a file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa41097010"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token punctuation">[</span><em class="replaceable">arguments</em><span class="token punctuation">]</span> > <em class="replaceable">file_name</em></code></pre>
</div>
<p>
To dump all databases, invoke
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
with
the
<a class="link" href="mysqldump.html#option_mysqldump_all-databases">
<code class="option">
--all-databases
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa26742420"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token property">--all-databases</span> > dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
To dump only specific databases, name them on the command line
and use the
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa52780911"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token property">--databases</span> db1 db2 db3 > dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
The
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
option causes
all names on the command line to be treated as database names.
Without this option,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
treats the
first name as a database name and those following as table
names.
</p>
<p>
With
<a class="link" href="mysqldump.html#option_mysqldump_all-databases">
<code class="option">
--all-databases
</code>
</a>
or
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
writes
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE
DATABASE
</code>
</a>
and
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements prior to the dump output for each database. This
ensures that when the dump file is reloaded, it creates each
database if it does not exist and makes it the default database
so database contents are loaded into the same database from
which they came. If you want to cause the dump file to force a
drop of each database before recreating it, use the
<a class="link" href="mysqldump.html#option_mysqldump_add-drop-database">
<code class="option">
--add-drop-database
</code>
</a>
option as
well. In this case,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
writes a
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
statement preceding
each
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE DATABASE
</code>
</a>
statement.
</p>
<p>
To dump a single database, name it on the command line:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93387988"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token property">--databases</span> test > dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
In the single-database case, it is permissible to omit the
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa48286046"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> test > dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
The difference between the two preceding commands is that
without
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
, the dump
output contains no
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE
DATABASE
</code>
</a>
or
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements. This has several implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When you reload the dump file, you must specify a default
database name so that the server knows which database to
reload.
</p>
</li>
<li class="listitem">
<p>
For reloading, you can specify a database name different
from the original name, which enables you to reload the data
into a different database.
</p>
</li>
<li class="listitem">
<p>
If the database to be reloaded does not exist, you must
create it first.
</p>
</li>
<li class="listitem">
<p>
Because the output contains no
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE
DATABASE
</code>
</a>
statement, the
<a class="link" href="mysqldump.html#option_mysqldump_add-drop-database">
<code class="option">
--add-drop-database
</code>
</a>
option
has no effect. If you use it, it produces no
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
statement.
</p>
</li>
</ul>
</div>
<p>
To dump only specific tables from a database, name them on the
command line following the database name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa64181760"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqldump</span> test t1 t3 t7 > dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
By default, if GTIDs are in use on the server where you create
the dump file (
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
),
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
includes a
<code class="literal">
SET
@@GLOBAL.gtid_purged
</code>
statement in the output to add
the GTIDs from the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
set on the source
server to the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_purged">
<code class="literal">
gtid_purged
</code>
</a>
set
on the target server. If you are dumping only specific databases
or tables, it is important to note that the value that is
included by
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
includes the GTIDs of
all transactions in the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
set on the source
server, even those that changed suppressed parts of the
database, or other databases on the server that were not
included in the partial dump. If you only replay one partial
dump file on the target server, the extra GTIDs do not cause any
problems with the future operation of that server. However, if
you replay a second dump file on the target server that contains
the same GTIDs (for example, another partial dump from the same
source server), any
<code class="literal">
SET @@GLOBAL.gtid_purged
</code>
statement in the second dump file fails. To avoid this issue,
either set the
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
option
<code class="option">
--set-gtid-purged
</code>
to
<code class="literal">
OFF
</code>
or
<code class="literal">
COMMENTED
</code>
to output the second dump file
without an active
<code class="literal">
SET @@GLOBAL.gtid_purged
</code>
statement, or remove the statement manually before replaying the
dump file.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-thread-states.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-thread-states">
</a>
10.14.8 NDB Cluster Thread States
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045221009008">
</a>
<a class="indexterm" name="idm46045221007520">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221004464">
</a>
<a class="indexterm" name="idm46045221002960">
</a>
<code class="literal">
Committing events to binlog
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220999984">
</a>
<a class="indexterm" name="idm46045220998480">
</a>
<code class="literal">
Opening mysql.ndb_apply_status
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220995504">
</a>
<a class="indexterm" name="idm46045220994016">
</a>
<code class="literal">
Processing events
</code>
</p>
<p>
The thread is processing events for binary logging.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220990592">
</a>
<a class="indexterm" name="idm46045220989088">
</a>
<code class="literal">
Processing events from schema table
</code>
</p>
<p>
The thread is doing the work of schema replication.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220985632">
</a>
<a class="indexterm" name="idm46045220984144">
</a>
<code class="literal">
Shutting down
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220981200">
</a>
<a class="indexterm" name="idm46045220979680">
</a>
<code class="literal">
Syncing ndb table schema operation and
binlog
</code>
</p>
<p>
This is used to have a correct binary log of schema
operations for NDB.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220976144">
</a>
<a class="indexterm" name="idm46045220974608">
</a>
<code class="literal">
Waiting for allowed to take ndbcluster global
schema lock
</code>
</p>
<p>
The thread is waiting for permission to take a global schema
lock.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220971072">
</a>
<a class="indexterm" name="idm46045220969568">
</a>
<code class="literal">
Waiting for event from ndbcluster
</code>
</p>
<p>
The server is acting as an SQL node in an NDB Cluster, and
is connected to a cluster management node.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220966048">
</a>
<a class="indexterm" name="idm46045220964544">
</a>
<code class="literal">
Waiting for first event from ndbcluster
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220961568">
</a>
<a class="indexterm" name="idm46045220960032">
</a>
<code class="literal">
Waiting for ndbcluster binlog update to reach
current position
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220956976">
</a>
<a class="indexterm" name="idm46045220955456">
</a>
<code class="literal">
Waiting for ndbcluster global schema lock
</code>
</p>
<p>
The thread is waiting for a global schema lock held by
another thread to be released.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220951920">
</a>
<a class="indexterm" name="idm46045220950416">
</a>
<code class="literal">
Waiting for ndbcluster to start
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045220947440">
</a>
<a class="indexterm" name="idm46045220945936">
</a>
<code class="literal">
Waiting for schema epoch
</code>
</p>
<p>
The thread is waiting for a schema epoch (that is, a global
checkpoint).
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-unicode-utf8.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-unicode-utf8">
</a>
12.9.3 The utf8 Character Set (Deprecated alias for utf8mb3)
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045216617904">
</a>
<a class="indexterm" name="idm46045216616864">
</a>
<a class="indexterm" name="idm46045216615376">
</a>
<p>
<code class="literal">
utf8
</code>
has been used by MySQL in the past as an
alias for the
<code class="literal">
utf8mb3
</code>
character set, but this
usage is now deprecated; in MySQL 8.4,
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statements and columns of
<a class="link" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
<code class="literal">
INFORMATION_SCHEMA
</code>
</a>
tables display
<code class="literal">
utf8mb3
</code>
instead. For more information, see
<a class="xref" href="charset-unicode-utf8mb3.html" title="12.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)">
Section 12.9.2, “The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The recommended character set for MySQL is
<code class="literal">
utf8mb4
</code>
. All new applications should use
<code class="literal">
utf8mb4
</code>
.
</p>
<p>
The
<code class="literal">
utf8mb3
</code>
character set is deprecated.
<code class="literal">
utf8mb3
</code>
remains supported for the lifetimes
of the MySQL 8.0.x and MySQL 8.4.x LTS release series.
</p>
<p>
Expect
<code class="literal">
utf8mb3
</code>
to be removed in a future
major release of MySQL.
</p>
<p>
Since changing character sets can be a complex and
time-consuming task, you should begin to prepare for this
change now by using
<code class="literal">
utf8mb4
</code>
for new
applications. For guidance in converting existing applications
which use utfmb3, see
<a class="xref" href="charset-unicode-conversion.html" title="12.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets">
Section 12.9.8, “Converting Between 3-Byte and 4-Byte Unicode Character Sets”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/dynindex-command.html | <div id="docs-body">
<div class="index">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="dynindex-command">
</a>
Command Index
</h2>
</div>
</div>
</div>
<p>
<a name="command-index-top">
</a>
<a class="link" href="dynindex-command.html#command-index-A" title="A">
A
</a>
|
<a class="link" href="dynindex-command.html#command-index-B" title="B">
B
</a>
|
<a class="link" href="dynindex-command.html#command-index-C" title="C">
C
</a>
|
<a class="link" href="dynindex-command.html#command-index-D" title="D">
D
</a>
|
<a class="link" href="dynindex-command.html#command-index-E" title="E">
E
</a>
|
<a class="link" href="dynindex-command.html#command-index-F" title="F">
F
</a>
|
<a class="link" href="dynindex-command.html#command-index-G" title="G">
G
</a>
|
<a class="link" href="dynindex-command.html#command-index-H" title="H">
H
</a>
|
<a class="link" href="dynindex-command.html#command-index-I" title="I">
I
</a>
|
<a class="link" href="dynindex-command.html#command-index-J" title="J">
J
</a>
|
<a class="link" href="dynindex-command.html#command-index-K" title="K">
K
</a>
|
<a class="link" href="dynindex-command.html#command-index-L" title="L">
L
</a>
|
<a class="link" href="dynindex-command.html#command-index-M" title="M">
M
</a>
|
<a class="link" href="dynindex-command.html#command-index-N" title="N">
N
</a>
|
<a class="link" href="dynindex-command.html#command-index-O" title="O">
O
</a>
|
<a class="link" href="dynindex-command.html#command-index-P" title="P">
P
</a>
|
<a class="link" href="dynindex-command.html#command-index-R" title="R">
R
</a>
|
<a class="link" href="dynindex-command.html#command-index-S" title="S">
S
</a>
|
<a class="link" href="dynindex-command.html#command-index-T" title="T">
T
</a>
|
<a class="link" href="dynindex-command.html#command-index-U" title="U">
U
</a>
|
<a class="link" href="dynindex-command.html#command-index-V" title="V">
V
</a>
|
<a class="link" href="dynindex-command.html#command-index-W" title="W">
W
</a>
|
<a class="link" href="dynindex-command.html#command-index-X" title="X">
X
</a>
|
<a class="link" href="dynindex-command.html#command-index-Y" title="Y">
Y
</a>
|
<a class="link" href="dynindex-command.html#command-index-Z" title="Z">
Z
</a>
</p>
<div class="indexdiv">
<a name="command-index-A">
</a>
<h3 class="title">
A
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Access
</h3>
<dl>
<dt>
<a class="xref" href="delete.html" title="15.2.2 DELETE Statement">
Section 15.2.2, “DELETE Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
addgroup
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
addr2line
</h3>
<dl>
<dt>
<a class="xref" href="using-stack-trace.html" title="7.9.1.5 Using a Stack Trace">
Section 7.9.1.5, “Using a Stack Trace”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
adduser
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ALTER TABLE
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-operations.html" title="25.6.12 Online Operations with ALTER TABLE in NDB Cluster">
Section 25.6.12, “Online Operations with ALTER TABLE in NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
APF
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-security-networking-issues.html" title="25.6.21.1 NDB Cluster Security and Networking Issues">
Section 25.6.21.1, “NDB Cluster Security and Networking Issues”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
apt-get
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-native.html" title="2.5.7 Installing MySQL on Linux from the Native Software Repositories">
Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-debian.html" title="2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle">
Section 2.5.5, “Installing MySQL on Linux Using Debian Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
apt-get install
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
apt-get purge
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
apt-get remove
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
apt-get upgrade
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
audit2allow
</h3>
<dl>
<dt>
<a class="xref" href="selinux-troubleshooting.html" title="8.7.6 Troubleshooting SELinux">
Section 8.7.6, “Troubleshooting SELinux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-B">
</a>
<h3 class="title">
B
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
bash
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-notes.html" title="2.4.1 General Notes on Installing MySQL on macOS">
Section 2.4.1, “General Notes on Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-replica.html" title="19.1.6.3 Replica Server Options and Variables">
Section 19.1.6.3, “Replica Server Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
Section 15.7.8.8, “RESTART Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
bison
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-C">
</a>
<h3 class="title">
C
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cat
</h3>
<dl>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cd
</h3>
<dl>
<dt>
<a class="xref" href="resetting-permissions.html#resetting-permissions-windows" title="B.3.3.2.1 Resetting the Root Password: Windows Systems">
Section B.3.3.2.1, “Resetting the Root Password: Windows Systems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
chkconfig
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
chmod
</h3>
<dl>
<dt>
<a class="xref" href="keyring-key-migration.html" title="8.4.4.11 Migrating Keys Between Keyring Keystores">
Section 8.4.4.11, “Migrating Keys Between Keyring Keystores”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
chown
</h3>
<dl>
<dt>
<a class="xref" href="keyring-key-migration.html" title="8.4.4.11 Migrating Keys Between Keyring Keystores">
Section 8.4.4.11, “Migrating Keys Between Keyring Keystores”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
clang
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
CMake
</h3>
<dl>
<dt>
<a class="xref" href="adding-character-set.html" title="12.13 Adding a Character Set">
Section 12.13, “Adding a Character Set”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cannot-initialize-character-set.html" title="B.3.2.15 Can't initialize character set">
Section B.3.2.15, “Can't initialize character set”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-source.html" title="25.3.2.2 Compiling and Installing NDB Cluster from Source on Windows">
Section 25.3.2.2, “Compiling and Installing NDB Cluster from Source on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-applications.html" title="12.5 Configuring Application Character Set and Collation">
Section 12.5, “Configuring Application Character Set and Collation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-ssl-library-configuration.html" title="2.8.6 Configuring SSL Library Support">
Section 2.8.6, “Configuring SSL Library Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-dictionary-schema.html" title="16.1 Data Dictionary Schema">
Section 16.1, “Data Dictionary Schema”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-general-info.html" title="25.1 General Information">
Section 25.1, “General Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-with-mysql-sock.html" title="B.3.3.6 How to Protect or Change the MySQL Unix Socket File">
Section B.3.3.6, “How to Protect or Change the MySQL Unix Socket File”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mysqld.html" title="25.6.10 MySQL Server Usage for NDB Cluster">
Section 25.6.10, “MySQL Server Usage for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-build-configuration.html" title="29.2 Performance Schema Build Configuration">
Section 29.2, “Performance Schema Build Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-unix-servers.html" title="7.8.3 Running Multiple MySQL Instances on Unix">
Section 7.8.3, “Running Multiple MySQL Instances on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data-local-security.html" title="8.1.6 Security Considerations for LOAD DATA LOCAL">
Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-server.html" title="12.3.2 Server Character Set and Collation">
Section 12.3.2, “Server Character Set and Collation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="archive-storage-engine.html" title="18.5 The ARCHIVE Storage Engine">
Section 18.5, “The ARCHIVE Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="blackhole-storage-engine.html" title="18.6 The BLACKHOLE Storage Engine">
Section 18.6, “The BLACKHOLE Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="example-storage-engine.html" title="18.9 The EXAMPLE Storage Engine">
Section 18.9, “The EXAMPLE Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="federated-storage-engine.html" title="18.8 The FEDERATED Storage Engine">
Section 18.8, “The FEDERATED Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="lock-order-tool.html" title="7.9.3 The LOCK_ORDER Tool">
Section 7.9.3, “The LOCK_ORDER Tool”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Cmake
</h3>
<dl>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cmake
</h3>
<dl>
<dt>
<a class="xref" href="source-installation-doxygen.html" title="2.8.10 Generating MySQL Doxygen Documentation Content">
Section 2.8.10, “Generating MySQL Doxygen Documentation Content”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cmd
</h3>
<dl>
<dt>
<a class="xref" href="resetting-permissions.html#resetting-permissions-windows" title="B.3.3.2.1 Resetting the Root Password: Windows Systems">
Section B.3.3.2.1, “Resetting the Root Password: Windows Systems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cmd.exe
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innochecksum.html" title="6.6.2 innochecksum — Offline InnoDB File Checksum Utility">
Section 6.6.2, “innochecksum — Offline InnoDB File Checksum Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
command.com
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
comp_err
</h3>
<dl>
<dt>
<a class="xref" href="comp-err.html" title="6.4.1 comp_err — Compile MySQL Error Message File">
Section 6.4.1, “comp_err — Compile MySQL Error Message File”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
configure
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
copy
</h3>
<dl>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
coreadm
</h3>
<dl>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cp
</h3>
<dl>
<dt>
<a class="xref" href="replication-howto-additionalslaves.html" title="19.1.2.8 Adding Replicas to a Replication Environment">
Section 19.1.2.8, “Adding Replicas to a Replication Environment”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups-rawdata.html" title="19.4.1.2 Backing Up Raw Data from a Replica">
Section 19.4.1.2, “Backing Up Raw Data from a Replica”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
cron
</h3>
<dl>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-start.html" title="18.2.1 MyISAM Startup Options">
Section 18.2.1, “MyISAM Startup Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-maintenance-schedule.html" title="9.6.5 Setting Up a MyISAM Table Maintenance Schedule">
Section 9.6.5, “Setting Up a MyISAM Table Maintenance Schedule”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="batch-mode.html" title="5.5 Using mysql in Batch Mode">
Section 5.5, “Using mysql in Batch Mode”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
csh
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-D">
</a>
<h3 class="title">
D
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
date
</h3>
<dl>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
df
</h3>
<dl>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Directory Utility
</h3>
<dl>
<dt>
<a class="xref" href="macos-installation-notes.html" title="2.4.1 General Notes on Installing MySQL on macOS">
Section 2.4.1, “General Notes on Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dnf
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="updating-yum-repo.html" title="3.8 Upgrading MySQL with the MySQL Yum Repository">
Section 3.8, “Upgrading MySQL with the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dnf config-manager
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dnf upgrade
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dnf upgrade mysql-server
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker exec
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker inspect
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker logs mysqld-container
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker ps
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker pull
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker rm
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker run
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
docker stop
</h3>
<dl>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dot
</h3>
<dl>
<dt>
<a class="xref" href="source-installation-doxygen.html" title="2.8.10 Generating MySQL Doxygen Documentation Content">
Section 2.8.10, “Generating MySQL Doxygen Documentation Content”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
doxygen
</h3>
<dl>
<dt>
<a class="xref" href="source-installation-doxygen.html" title="2.8.10 Generating MySQL Doxygen Documentation Content">
Section 2.8.10, “Generating MySQL Doxygen Documentation Content”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dpkg
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-debian.html" title="2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle">
Section 2.5.5, “Installing MySQL on Linux Using Debian Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dump
</h3>
<dl>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-E">
</a>
<h3 class="title">
E
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
export
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-F">
</a>
<h3 class="title">
F
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
flex
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="lock-order-tool.html" title="7.9.3 The LOCK_ORDER Tool">
Section 7.9.3, “The LOCK_ORDER Tool”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-G">
</a>
<h3 class="title">
G
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gcc
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perl-support-problems.html" title="2.10.3 Problems Using the Perl DBI/DBD Interface">
Section 2.10.3, “Problems Using the Perl DBI/DBD Interface”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gcov
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gdb
</h3>
<dl>
<dt>
<a class="xref" href="compiling-for-debugging.html" title="7.9.1.1 Compiling MySQL for Debugging">
Section 7.9.1.1, “Compiling MySQL for Debugging”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-gdb-on-mysqld.html" title="7.9.1.4 Debugging mysqld under gdb">
Section 7.9.1.4, “Debugging mysqld under gdb”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
getcap
</h3>
<dl>
<dt>
<a class="xref" href="resource-groups.html" title="7.1.16 Resource Groups">
Section 7.1.16, “Resource Groups”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
getenforce
</h3>
<dl>
<dt>
<a class="xref" href="selinux-mode.html" title="8.7.2 Changing the SELinux Mode">
Section 8.7.2, “Changing the SELinux Mode”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
git branch
</h3>
<dl>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
git checkout
</h3>
<dl>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
git log
</h3>
<dl>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
git pull
</h3>
<dl>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gmake
</h3>
<dl>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
GnuPG
</h3>
<dl>
<dt>
<a class="xref" href="checking-gpg-signature.html" title="2.1.4.2 Signature Checking Using GnuPG">
Section 2.1.4.2, “Signature Checking Using GnuPG”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gnutar
</h3>
<dl>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gogoc
</h3>
<dl>
<dt>
<a class="xref" href="ipv6-brokers.html" title="7.1.13.5 Obtaining an IPv6 Address from a Broker">
Section 7.1.13.5, “Obtaining an IPv6 Address from a Broker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gold
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gpg
</h3>
<dl>
<dt>
<a class="xref" href="checking-gpg-signature.html" title="2.1.4.2 Signature Checking Using GnuPG">
Section 2.1.4.2, “Signature Checking Using GnuPG”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gprof
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
grep
</h3>
<dl>
<dt>
<a class="xref" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
Section 6.6.10, “mysqldumpslow — Summarize Slow Query Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="pattern-matching.html" title="5.3.4.7 Pattern Matching">
Section 5.3.4.7, “Pattern Matching”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
groupadd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gtar
</h3>
<dl>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gunzip
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-logging-configuration.html" title="8.4.5.5 Configuring Audit Logging Characteristics">
Section 8.4.5.5, “Configuring Audit Logging Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
gzip
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-logging-configuration.html" title="8.4.5.5 Configuring Audit Logging Characteristics">
Section 8.4.5.5, “Configuring Audit Logging Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation.html" title="2.4 Installing MySQL on macOS">
Section 2.4, “Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-H">
</a>
<h3 class="title">
H
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
help contents
</h3>
<dl>
<dt>
<a class="xref" href="mysql-server-side-help.html" title="6.5.1.4 mysql Client Server-Side Help">
Section 6.5.1.4, “mysql Client Server-Side Help”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
hostname
</h3>
<dl>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-I">
</a>
<h3 class="title">
I
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ibd2sdi
</h3>
<dl>
<dt>
<a class="xref" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
Section 6.6.1, “ibd2sdi — InnoDB Tablespace SDI Extraction Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="serialized-dictionary-information.html" title="16.6 Serialized Dictionary Information (SDI)">
Section 16.6, “Serialized Dictionary Information (SDI)”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
icc
</h3>
<dl>
<dt>
<a class="xref" href="compiler-characteristics.html" title="2.1.6 Compiler-Specific Build Characteristics">
Section 2.1.6, “Compiler-Specific Build Characteristics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ifconfig
</h3>
<dl>
<dt>
<a class="xref" href="ipv6-system-support.html" title="7.1.13.1 Verifying System Support for IPv6">
Section 7.1.13.1, “Verifying System Support for IPv6”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
innochecksum
</h3>
<dl>
<dt>
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innochecksum.html" title="6.6.2 innochecksum — Offline InnoDB File Checksum Utility">
Section 6.6.2, “innochecksum — Offline InnoDB File Checksum Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ip
</h3>
<dl>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
iptables
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-frequently-asked-questions.html" title="20.10 Frequently Asked Questions">
Section 20.10, “Frequently Asked Questions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-networking-issues.html" title="25.6.21.1 NDB Cluster Security and Networking Issues">
Section 25.6.21.1, “NDB Cluster Security and Networking Issues”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-J">
</a>
<h3 class="title">
J
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
java
</h3>
<dl>
<dt>
<a class="xref" href="keyring-okv-plugin.html" title="8.4.4.6 Using the keyring_okv KMIP Plugin">
Section 8.4.4.6, “Using the keyring_okv KMIP Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
jq
</h3>
<dl>
<dt>
<a class="xref" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
Section 6.6.1, “ibd2sdi — InnoDB Tablespace SDI Extraction Utility”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-K">
</a>
<h3 class="title">
K
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
kill
</h3>
<dl>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="unix-signal-response.html" title="6.10 Unix Signal Handling in MySQL">
Section 6.10, “Unix Signal Handling in MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
kinit
</h3>
<dl>
<dt>
<a class="xref" href="kerberos-pluggable-authentication.html" title="8.4.1.8 Kerberos Pluggable Authentication">
Section 8.4.1.8, “Kerberos Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
klist
</h3>
<dl>
<dt>
<a class="xref" href="kerberos-pluggable-authentication.html" title="8.4.1.8 Kerberos Pluggable Authentication">
Section 8.4.1.8, “Kerberos Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ksh
</h3>
<dl>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
kswapd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
kswitch
</h3>
<dl>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-L">
</a>
<h3 class="title">
L
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ld
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ldapsearch
</h3>
<dl>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
less
</h3>
<dl>
<dt>
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
lld
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ln
</h3>
<dl>
<dt>
<a class="xref" href="symbolic-links-to-tables.html" title="10.12.2.2 Using Symbolic Links for MyISAM Tables on Unix">
Section 10.12.2.2, “Using Symbolic Links for MyISAM Tables on Unix”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
logger
</h3>
<dl>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ls
</h3>
<dl>
<dt>
<a class="xref" href="selinux.html" title="8.7 SELinux">
Section 8.7, “SELinux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
lsof +L1
</h3>
<dl>
<dt>
<a class="xref" href="temporary-files.html" title="B.3.3.5 Where MySQL Stores Temporary Files">
Section B.3.3.5, “Where MySQL Stores Temporary Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
lz4_decompress
</h3>
<dl>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-M">
</a>
<h3 class="title">
M
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
m4
</h3>
<dl>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perl-support-problems.html" title="2.10.3 Problems Using the Perl DBI/DBD Interface">
Section 2.10.3, “Problems Using the Perl DBI/DBD Interface”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make && make install
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make install
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make package
</h3>
<dl>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make test
</h3>
<dl>
<dt>
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perl-installation.html" title="2.10.1 Installing Perl on Unix">
Section 2.10.1, “Installing Perl on Unix”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
make VERBOSE=1
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
md5
</h3>
<dl>
<dt>
<a class="xref" href="verifying-md5-checksum.html" title="2.1.4.1 Verifying the MD5 Checksum">
Section 2.1.4.1, “Verifying the MD5 Checksum”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
md5.exe
</h3>
<dl>
<dt>
<a class="xref" href="verifying-md5-checksum.html" title="2.1.4.1 Verifying the MD5 Checksum">
Section 2.1.4.1, “Verifying the MD5 Checksum”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
md5sum
</h3>
<dl>
<dt>
<a class="xref" href="verifying-md5-checksum.html" title="2.1.4.1 Verifying the MD5 Checksum">
Section 2.1.4.1, “Verifying the MD5 Checksum”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
memcached
</h3>
<dl>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mgmd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-installation.html" title="25.3 NDB Cluster Installation">
Section 25.3, “NDB Cluster Installation”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mkdir
</h3>
<dl>
<dt>
<a class="xref" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
Section 15.1.12, “CREATE DATABASE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-dictionary-limitations.html" title="16.8 Data Dictionary Limitations">
Section 16.8, “Data Dictionary Limitations”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mklink
</h3>
<dl>
<dt>
<a class="xref" href="windows-symbolic-links.html" title="10.12.2.3 Using Symbolic Links for Databases on Windows">
Section 10.12.2.3, “Using Symbolic Links for Databases on Windows”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mold
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
more
</h3>
<dl>
<dt>
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mv
</h3>
<dl>
<dt>
<a class="xref" href="error-log-rotation.html" title="7.4.2.10 Error Log File Flushing and Renaming">
Section 7.4.2.10, “Error Log File Flushing and Renaming”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="symbolic-links-to-databases.html" title="10.12.2.1 Using Symbolic Links for Databases on Unix">
Section 10.12.2.1, “Using Symbolic Links for Databases on Unix”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
my_print_defaults
</h3>
<dl>
<dt>
<a class="xref" href="my-print-defaults.html" title="6.7.2 my_print_defaults — Display Options from Option Files">
Section 6.7.2, “my_print_defaults — Display Options from Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-development.html" title="6.7 Program Development Utilities">
Section 6.7, “Program Development Utilities”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisam_ftdump
</h3>
<dl>
<dt>
<a class="xref" href="fulltext-search.html" title="14.9 Full-Text Search Functions">
Section 14.9, “Full-Text Search Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-ftdump.html" title="6.6.3 myisam_ftdump — Display Full-Text Index information">
Section 6.6.3, “myisam_ftdump — Display Full-Text Index information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisamchk
</h3>
<dl>
<dt>
<a class="xref" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
Section 15.7.3.1, “ANALYZE TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimizing-myisam-bulk-data-loading.html" title="10.6.2 Bulk Data Loading for MyISAM Tables">
Section 10.6.2, “Bulk Data Loading for MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compressed-format.html" title="18.2.3.3 Compressed Table Characteristics">
Section 18.2.3.3, “Compressed Table Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="corrupted-myisam-tables.html" title="18.2.4.1 Corrupted MyISAM Tables">
Section 18.2.4.1, “Corrupted MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-methods.html" title="9.2 Database Backup Methods">
Section 9.2, “Database Backup Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="debugging-server.html" title="7.9.1 Debugging a MySQL Server">
Section 7.9.1, “Debugging a MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="delete.html" title="15.2.2 DELETE Statement">
Section 15.2.2, “DELETE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="dynamic-format.html" title="18.2.3.2 Dynamic Table Characteristics">
Section 18.2.3.2, “Dynamic Table Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="explain-output.html" title="10.8.2 EXPLAIN Output Format">
Section 10.8.2, “EXPLAIN Output Format”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="external-locking.html" title="10.11.5 External Locking">
Section 10.11.5, “External Locking”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="fulltext-fine-tuning.html" title="14.9.6 Fine-Tuning MySQL Full-Text Search">
Section 14.9.6, “Fine-Tuning MySQL Full-Text Search”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-check.html" title="9.6.2 How to Check MyISAM Tables for Errors">
Section 9.6.2, “How to Check MyISAM Tables for Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="index-statistics.html" title="10.3.8 InnoDB and MyISAM Index Statistics Collection">
Section 10.3.8, “InnoDB and MyISAM Index Statistics Collection”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-size-limit.html" title="10.4.6 Limits on Table Size">
Section 10.4.6, “Limits on Table Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-index.html" title="15.7.8.5 LOAD INDEX INTO CACHE Statement">
Section 15.7.8.5, “LOAD INDEX INTO CACHE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reproducible-test-case.html" title="7.9.1.7 Making a Test Case If You Experience Table Corruption">
Section 7.9.1.7, “Making a Test Case If You Experience Table Corruption”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-start.html" title="18.2.1 MyISAM Startup Options">
Section 18.2.1, “MyISAM Startup Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-maintenance.html" title="9.6 MyISAM Table Maintenance and Crash Recovery">
Section 9.6, “MyISAM Table Maintenance and Crash Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-optimization.html" title="9.6.4 MyISAM Table Optimization">
Section 9.6.4, “MyISAM Table Optimization”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-formats.html" title="18.2.3 MyISAM Table Storage Formats">
Section 18.2.3, “MyISAM Table Storage Formats”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-check-options.html" title="6.6.4.2 myisamchk Check Options">
Section 6.6.4.2, “myisamchk Check Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-general-options.html" title="6.6.4.1 myisamchk General Options">
Section 6.6.4.1, “myisamchk General Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-memory.html" title="6.6.4.6 myisamchk Memory Usage">
Section 6.6.4.6, “myisamchk Memory Usage”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-repair-options.html" title="6.6.4.3 myisamchk Repair Options">
Section 6.6.4.3, “myisamchk Repair Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
Section 6.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-table-info.html" title="6.6.4.5 Obtaining Table Information with myisamchk">
Section 6.6.4.5, “Obtaining Table Information with myisamchk”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimizing-queries-myisam.html" title="10.6.1 Optimizing MyISAM Queries">
Section 10.6.1, “Optimizing MyISAM Queries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="repair-table-optimization.html" title="10.6.3 Optimizing REPAIR TABLE Statements">
Section 10.6.3, “Optimizing REPAIR TABLE Statements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-other-options.html" title="6.6.4.4 Other myisamchk Options">
Section 6.6.4.4, “Other myisamchk Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-close.html" title="18.2.4.2 Problems from Tables Not Being Closed Properly">
Section 18.2.4.2, “Problems from Tables Not Being Closed Properly”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
Section 15.7.3.5, “REPAIR TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-maintenance-schedule.html" title="9.6.5 Setting Up a MyISAM Table Maintenance Schedule">
Section 9.6.5, “Setting Up a MyISAM Table Maintenance Schedule”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
Section 15.7.7.23, “SHOW INDEX Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
Section 15.7.7.38, “SHOW TABLE STATUS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="static-format.html" title="18.2.3.1 Static (Fixed-Length) Table Characteristics">
Section 18.2.3.1, “Static (Fixed-Length) Table Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-statistics-table.html" title="28.3.34 The INFORMATION_SCHEMA STATISTICS Table">
Section 28.3.34, “The INFORMATION_SCHEMA STATISTICS Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
Section 28.3.38, “The INFORMATION_SCHEMA TABLES Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
Section 18.2, “The MyISAM Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-crash-recovery.html" title="9.6.1 Using myisamchk for Crash Recovery">
Section 9.6.1, “Using myisamchk for Crash Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-log-files.html" title="7.9.1.6 Using Server Logs to Find Causes of Errors in mysqld">
Section 7.9.1.6, “Using Server Logs to Find Causes of Errors in mysqld”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="symbolic-links-to-tables.html" title="10.12.2.2 Using Symbolic Links for MyISAM Tables on Unix">
Section 10.12.2.2, “Using Symbolic Links for MyISAM Tables on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisamchk *.MYI
</h3>
<dl>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisamchk tbl_name
</h3>
<dl>
<dt>
<a class="xref" href="myisam-check.html" title="9.6.2 How to Check MyISAM Tables for Errors">
Section 9.6.2, “How to Check MyISAM Tables for Errors”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisamlog
</h3>
<dl>
<dt>
<a class="xref" href="myisamlog.html" title="6.6.5 myisamlog — Display MyISAM Log File Contents">
Section 6.6.5, “myisamlog — Display MyISAM Log File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
myisampack
</h3>
<dl>
<dt>
<a class="xref" href="optimizing-myisam-bulk-data-loading.html" title="10.6.2 Bulk Data Loading for MyISAM Tables">
Section 10.6.2, “Bulk Data Loading for MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compressed-format.html" title="18.2.3.3 Compressed Table Characteristics">
Section 18.2.3.3, “Compressed Table Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="external-locking.html" title="10.11.5 External Locking">
Section 10.11.5, “External Locking”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-size-limit.html" title="10.4.6 Limits on Table Size">
Section 10.4.6, “Limits on Table Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="merge-table-advantages.html" title="18.7.1 MERGE Table Advantages and Disadvantages">
Section 18.7.1, “MERGE Table Advantages and Disadvantages”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-formats.html" title="18.2.3 MyISAM Table Storage Formats">
Section 18.2.3, “MyISAM Table Storage Formats”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-repair-options.html" title="6.6.4.3 myisamchk Repair Options">
Section 6.6.4.3, “myisamchk Repair Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
Section 6.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-table-info.html" title="6.6.4.5 Obtaining Table Information with myisamchk">
Section 6.6.4.5, “Obtaining Table Information with myisamchk”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-size.html" title="10.4.1 Optimizing Data Size">
Section 10.4.1, “Optimizing Data Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="silent-column-changes.html" title="15.1.20.7 Silent Column Specification Changes">
Section 15.1.20.7, “Silent Column Specification Changes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="merge-storage-engine.html" title="18.7 The MERGE Storage Engine">
Section 18.7, “The MERGE Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
Section 18.2, “The MyISAM Storage Engine”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-adding-binlog-master.html" title="19.1.5.4 Adding Binary Log Based Replication Sources to a Multi-Source Replica">
Section 19.1.5.4, “Adding Binary Log Based Replication Sources to a Multi-Source Replica”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-adding-gtid-master.html" title="19.1.5.3 Adding GTID-Based Sources to a Multi-Source Replica">
Section 19.1.5.3, “Adding GTID-Based Sources to a Multi-Source Replica”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-basics.html" title="25.6.7.2 Adding NDB Cluster Data Nodes Online: Basic procedure">
Section 25.6.7.2, “Adding NDB Cluster Data Nodes Online: Basic procedure”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-remarks.html" title="25.6.7.1 Adding NDB Cluster Data Nodes Online: General Issues">
Section 25.6.7.1, “Adding NDB Cluster Data Nodes Online: General Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="aggregate-functions.html" title="14.19.1 Aggregate Function Descriptions">
Section 14.19.1, “Aggregate Function Descriptions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
Section 15.7.1.1, “ALTER USER Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
Section 15.6.1, “BEGIN ... END Compound Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bit-functions.html" title="14.12 Bit Functions and Operators">
Section 14.12, “Bit Functions and Operators”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cast-functions.html" title="14.10 Cast Functions and Operators">
Section 14.10, “Cast Functions and Operators”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-options.html" title="6.2.3 Command Options for Connecting to the Server">
Section 6.2.3, “Command Options for Connecting to the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="comments.html" title="11.7 Comments">
Section 11.7, “Comments”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-configuration.html" title="25.4 Configuration of NDB Cluster">
Section 25.4, “Configuration of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-applications.html" title="12.5 Configuring Application Character Set and Collation">
Section 12.5, “Configuring Application Character Set and Collation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-configuration.html" title="19.1.5.1 Configuring Multi-Source Replication">
Section 19.1.5.1, “Configuring Multi-Source Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-statistics-estimation.html" title="17.8.10.2 Configuring Non-Persistent Optimizer Statistics Parameters">
Section 17.8.10.2, “Configuring Non-Persistent Optimizer Statistics Parameters”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting-disconnecting.html" title="5.1 Connecting to and Disconnecting from the Server">
Section 5.1, “Connecting to and Disconnecting from the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting-using-dns-srv.html" title="6.2.6 Connecting to the Server Using DNS SRV Records">
Section 6.2.6, “Connecting to the Server Using DNS SRV Records”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting-using-uri-or-key-value-pairs.html" title="6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs">
Section 6.2.5, “Connecting to the Server Using URI-Like Strings or Key-Value Pairs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ipv6-remote-connections.html" title="7.1.13.4 Connecting Using IPv6 Nonlocal Host Addresses">
Section 7.1.13.4, “Connecting Using IPv6 Nonlocal Host Addresses”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ipv6-local-connections.html" title="7.1.13.3 Connecting Using the IPv6 Local Host Address">
Section 7.1.13.3, “Connecting Using the IPv6 Local Host Address”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="converting-tables-to-innodb.html" title="17.6.1.5 Converting Tables from MyISAM to InnoDB">
Section 17.6.1.5, “Converting Tables from MyISAM to InnoDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="copying-databases.html" title="3.15 Copying MySQL Databases to Another Machine">
Section 3.15, “Copying MySQL Databases to Another Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
Section 15.1.17, “CREATE PROCEDURE and CREATE FUNCTION Statements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-database.html" title="5.3.1 Creating and Selecting a Database">
Section 5.3.1, “Creating and Selecting a Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-installation-windows-path.html" title="2.3.3.7 Customizing the PATH for MySQL Tools">
Section 2.3.3.7, “Customizing the PATH for MySQL Tools”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-dictionary-schema.html" title="16.1 Data Dictionary Schema">
Section 16.1, “Data Dictionary Schema”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="debugging-client.html" title="7.9.2 Debugging a MySQL Client">
Section 7.9.2, “Debugging a MySQL Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-api-definition.html" title="25.4.3.7 Defining SQL and Other API Nodes in an NDB Cluster">
Section 25.4.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="stored-programs-defining.html" title="27.1 Defining Stored Programs">
Section 27.1, “Defining Stored Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="displaying-traces.html" title="10.15.13 Displaying Traces in Other Applications">
Section 10.15.13, “Displaying Traces in Other Applications”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-enabling-monitors.html" title="17.17.2 Enabling InnoDB Monitors">
Section 17.17.2, “Enabling InnoDB Monitors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="encryption-functions.html" title="14.13 Encryption and Compression Functions">
Section 14.13, “Encryption and Compression Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="entering-queries.html" title="5.2 Entering Queries">
Section 5.2, “Entering Queries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-interfaces.html" title="B.2 Error Information Interfaces">
Section B.2, “Error Information Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-message-elements.html" title="B.1 Error Message Sources and Elements">
Section B.1, “Error Message Sources and Elements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-logs-event-buffer.html" title="25.6.2.3 Event Buffer Reporting in the Cluster Log">
Section 25.6.2.3, “Event Buffer Reporting in the Cluster Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="events-configuration.html" title="27.4.2 Event Scheduler Configuration">
Section 27.4.2, “Event Scheduler Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-strategy-example.html" title="9.3 Example Backup and Recovery Strategy">
Section 9.3, “Example Backup and Recovery Strategy”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="examples.html" title="5.6 Examples of Common Queries">
Section 5.6, “Examples of Common Queries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="partitioning-management-exchange.html" title="26.3.3 Exchanging Partitions and Subpartitions with Tables">
Section 26.3.3, “Exchanging Partitions and Subpartitions with Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-batch-commands.html" title="6.5.1.5 Executing SQL Statements from a Text File">
Section 6.5.1.5, “Executing SQL Statements from a Text File”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="functions.html" title="Chapter 14 Functions and Operators">
Chapter 14,
<i>
Functions and Operators
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="json-search-functions.html" title="14.17.3 Functions That Search JSON Values">
Section 14.17.3, “Functions That Search JSON Values”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-general-info.html" title="25.1 General Information">
Section 25.1, “General Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-notes.html" title="2.4.1 General Notes on Installing MySQL on macOS">
Section 2.4.1, “General Notes on Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
Section 15.6.7.3, “GET DIAGNOSTICS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-deadlocks-handling.html" title="17.7.5.3 How to Minimize and Handle Deadlocks">
Section 17.7.5.3, “How to Minimize and Handle Deadlocks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="changing-mysql-user.html" title="8.1.5 How to Run MySQL as a Normal User">
Section 8.1.5, “How to Run MySQL as a Normal User”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="import-table.html" title="15.2.6 IMPORT TABLE Statement">
Section 15.2.6, “IMPORT TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-importing-data.html" title="25.6.9 Importing Data Into MySQL Cluster">
Section 25.6.9, “Importing Data Into MySQL Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-functions.html" title="14.15 Information Functions">
Section 14.15, “Information Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-recovery.html" title="17.18.2 InnoDB Recovery">
Section 17.18.2, “InnoDB Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-limitations-exclusive-to-cluster.html" title="25.2.7.8 Issues Exclusive to NDB Cluster">
Section 25.2.7.8, “Issues Exclusive to NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="kerberos-pluggable-authentication.html" title="8.4.1.8 Kerberos Pluggable Authentication">
Section 8.4.1.8, “Kerberos Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-launching.html" title="20.2.1.4 Launching Group Replication">
Section 20.2.1.4, “Launching Group Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="limit-optimization.html" title="10.2.1.19 LIMIT Query Optimization">
Section 10.2.1.19, “LIMIT Query Optimization”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-xml.html" title="15.2.10 LOAD XML Statement">
Section 15.2.10, “LOAD XML Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-copying-database.html" title="9.4.5.1 Making a Copy of a Database">
Section 9.4.5.1, “Making a Copy of a Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-management.html" title="25.6 Management of NDB Cluster">
Section 25.6, “Management of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="select-benchmarking.html" title="10.13.1 Measuring the Speed of Expressions and Functions">
Section 10.13.1, “Measuring the Speed of Expressions and Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="miscellaneous-functions.html" title="14.23 Miscellaneous Functions">
Section 14.23, “Miscellaneous Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multifactor-authentication.html" title="8.2.18 Multifactor Authentication">
Section 8.2.18, “Multifactor Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-cjk.html" title="A.11 MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean Character Sets">
Section A.11, “MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean
Character Sets”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-logging.html" title="6.5.1.3 mysql Client Logging">
Section 6.5.1.3, “mysql Client Logging”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server-side-help.html" title="6.5.1.4 mysql Client Server-Side Help">
Section 6.5.1.4, “mysql Client Server-Side Help”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-tips.html" title="6.5.1.6 mysql Client Tips">
Section 6.5.1.6, “mysql Client Tips”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-masking-plugin-functions.html" title="8.5.3.4 MySQL Enterprise Data Masking and De-Identification Plugin Function Descriptions">
Section 8.5.3.4, “MySQL Enterprise Data Masking and De-Identification Plugin Function Descriptions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
Section 7.1.15, “MySQL Server Time Zone Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mysqld.html" title="25.6.10 MySQL Server Usage for NDB Cluster">
Section 25.6.10, “MySQL Server Usage for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-shell-userguide.html" title="Chapter 21 MySQL Shell">
Chapter 21,
<i>
MySQL Shell
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
Section 6.4.3, “mysql_tzinfo_to_sql — Load the Time Zone Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
Section 6.5.6, “mysqlshow — Display Database, Table, and Column Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-backups.html" title="25.7.9 NDB Cluster Backups With NDB Cluster Replication">
Section 25.7.9, “NDB Cluster Backups With NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-disk-data-objects.html" title="25.6.11.1 NDB Cluster Disk Data Objects">
Section 25.6.11.1, “NDB Cluster Disk Data Objects”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-example-data.html" title="25.3.5 NDB Cluster Example with Tables and Data">
Section 25.3.5, “NDB Cluster Example with Tables and Data”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication.html" title="25.7 NDB Cluster Replication">
Section 25.7, “NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
Section 25.5.9, “ndb_desc — Describe NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-index-stat.html" title="25.5.14 ndb_index_stat — NDB Index Statistics Utility">
Section 25.5.14, “ndb_index_stat — NDB Index Statistics Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
Section 25.5.5, “ndb_mgm — The NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-backup-file.html" title="25.5.17 ndb_print_backup_file — Print NDB Backup File Contents">
Section 25.5.17, “ndb_print_backup_file — Print NDB Backup File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo.html" title="25.6.17 ndbinfo: The NDB Cluster Information Database">
Section 25.6.17, “ndbinfo: The NDB Cluster Information Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbinfo-select-all.html" title="25.5.2 ndbinfo_select_all — Select From ndbinfo Tables">
Section 25.5.2, “ndbinfo_select_all — Select From ndbinfo Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbxfrm.html" title="25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB Cluster">
Section 25.5.32, “ndbxfrm — Compress, Decompress, Encrypt, and Decrypt
Files Created by NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-defaults-equals.html" title="6.2.2.6 Option Defaults, Options Expecting Values, and the = Sign">
Section 6.2.2.6, “Option Defaults, Options Expecting Values, and the = Sign”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="out-of-memory.html" title="B.3.2.6 Out of memory">
Section B.3.2.6, “Out of memory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="packet-too-large.html" title="B.3.2.8 Packet Too Large">
Section B.3.2.8, “Packet Too Large”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="pam-pluggable-authentication.html" title="8.4.1.5 PAM Pluggable Authentication">
Section 8.4.1.5, “PAM Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="point-in-time-recovery-binlog.html" title="9.5.1 Point-in-Time Recovery Using Binary Log">
Section 9.5.1, “Point-in-Time Recovery Using Binary Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sql-prepared-statements.html" title="15.5 Prepared Statements">
Section 15.5, “Prepared Statements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-preparation.html" title="25.7.5 Preparing the NDB Cluster for Replication">
Section 25.7.5, “Preparing the NDB Cluster for Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-privilege-synchronization.html" title="25.6.13 Privilege Synchronization and NDB_STORED_USER">
Section 25.6.13, “Privilege Synchronization and NDB_STORED_USER”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-modifiers.html" title="6.2.2.4 Program Option Modifiers">
Section 6.2.2.4, “Program Option Modifiers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-provision-replica.html" title="19.1.5.2 Provisioning a Multi-Source Replica for GTID-Based Replication">
Section 19.1.5.2, “Provisioning a Multi-Source Replica for GTID-Based Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="query-attributes.html" title="11.6 Query Attributes">
Section 11.6, “Query Attributes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="partitioning-columns-range.html" title="26.2.3.1 RANGE COLUMNS partitioning">
Section 26.2.3.1, “RANGE COLUMNS partitioning”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="audit-log-file-reading.html" title="8.4.5.6 Reading Audit Log Files">
Section 8.4.5.6, “Reading Audit Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rebuilding-tables.html" title="3.14 Rebuilding or Repairing Tables or Indexes">
Section 3.14, “Rebuilding or Repairing Tables or Indexes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reloading-delimited-text-dumps.html" title="9.4.4 Reloading Delimited-Text Format Backups">
Section 9.4.4, “Reloading Delimited-Text Format Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reloading-sql-format-dumps.html" title="9.4.2 Reloading SQL-Format Backups">
Section 9.4.2, “Reloading SQL-Format Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resetting-permissions.html#resetting-permissions-generic" title="B.3.3.2.3 Resetting the Root Password: Generic Instructions">
Section B.3.3.2.3, “Resetting the Root Password: Generic Instructions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="revoke.html" title="15.7.1.8 REVOKE Statement">
Section 15.7.1.8, “REVOKE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="default-privileges.html" title="2.9.4 Securing the Initial MySQL Account">
Section 2.9.4, “Securing the Initial MySQL Account”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data-local-security.html" title="8.1.6 Security Considerations for LOAD DATA LOCAL">
Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="expired-password-handling.html" title="8.2.16 Server Handling of Expired Passwords">
Section 8.2.16, “Server Handling of Expired Passwords”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-side-help-support.html" title="7.1.17 Server-Side Help Support">
Section 7.1.17, “Server-Side Help Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="set-operations.html" title="15.2.14 Set Operations with UNION, INTERSECT, and EXCEPT">
Section 15.2.14, “Set Operations with UNION, INTERSECT, and EXCEPT”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table-ndb-comment-options.html" title="15.1.20.12 Setting NDB Comment Options">
Section 15.1.20.12, “Setting NDB Comment Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
Section 15.7.7.35, “SHOW REPLICA STATUS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
Section 15.7.7.42, “SHOW WARNINGS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="signal.html" title="15.6.7.5 SIGNAL Statement">
Section 15.6.7.5, “SIGNAL Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="socket-pluggable-authentication.html" title="8.4.1.10 Socket Peer-Credential Pluggable Authentication">
Section 8.4.1.10, “Socket Peer-Credential Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="program-options.html" title="6.2.2 Specifying Program Options">
Section 6.2.2, “Specifying Program Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-start-replica.html" title="19.1.5.5 Starting Multi-Source Replicas">
Section 19.1.5.5, “Starting Multi-Source Replicas”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-starting.html" title="25.7.6 Starting NDB Cluster Replication (Single Replication Channel)">
Section 25.7.6, “Starting NDB Cluster Replication (Single Replication Channel)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="string-comparison-functions.html" title="14.8.1 String Comparison Functions and Operators">
Section 14.8.1, “String Comparison Functions and Operators”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
Section 14.8, “String Functions and Operators”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="string-literals.html" title="11.1.1 String Literals">
Section 11.1.1, “String Literals”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
Section 13.3.3, “The BINARY and VARBINARY Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-binary-set.html" title="12.10.8 The Binary Character Set">
Section 12.10.8, “The Binary Character Set”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
Section 13.3.4, “The BLOB and TEXT Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sys-diagnostics.html" title="30.4.4.2 The diagnostics() Procedure">
Section 30.4.4.2, “The diagnostics() Procedure”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-backup-id.html" title="25.6.17.3 The ndbinfo backup_id Table">
Section 25.6.17.3, “The ndbinfo backup_id Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-memory-per-fragment.html" title="25.6.17.47 The ndbinfo memory_per_fragment Table">
Section 25.6.17.47, “The ndbinfo memory_per_fragment Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-transporters.html" title="25.6.17.66 The ndbinfo transporters Table">
Section 25.6.17.66, “The ndbinfo transporters Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="trigger-syntax.html" title="27.3.1 Trigger Syntax and Examples">
Section 27.3.1, “Trigger Syntax and Examples”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="tutorial.html" title="Chapter 5 Tutorial">
Chapter 5,
<i>
Tutorial
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="unix-signal-response.html" title="6.10 Unix Signal Handling in MySQL">
Section 6.10, “Unix Signal Handling in MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="recovery-from-backups.html" title="9.3.2 Using Backups for Recovery">
Section 9.3.2, “Using Backups for Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-failover.html" title="19.1.3.5 Using GTIDs for Failover and Scaleout">
Section 19.1.3.5, “Using GTIDs for Failover and Scaleout”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-enterprise-backup.html" title="20.5.6 Using MySQL Enterprise Backup with Group Replication">
Section 20.5.6, “Using MySQL Enterprise Backup with Group Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="firewall-usage.html" title="8.4.7.3 Using MySQL Enterprise Firewall">
Section 8.4.7.3, “Using MySQL Enterprise Firewall”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="batch-mode.html" title="5.5 Using mysql in Batch Mode">
Section 5.5, “Using mysql in Batch Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-backup.html" title="6.6.9.3 Using mysqlbinlog to Back Up Binary Log Files">
Section 6.6.9.3, “Using mysqlbinlog to Back Up Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-mysqldump.html" title="9.4 Using mysqldump for Backups">
Section 9.4, “Using mysqldump for Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="command-line-options.html" title="6.2.2.1 Using Options on the Command Line">
Section 6.2.2.1, “Using Options on the Command Line”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="program-variables.html" title="6.2.2.5 Using Options to Set Program Variables">
Section 6.2.2.5, “Using Options to Set Program Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-log-files.html" title="7.9.1.6 Using Server Logs to Find Causes of Errors in mysqld">
Section 7.9.1.6, “Using Server Logs to Find Causes of Errors in mysqld”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-symbolic-links.html" title="10.12.2.3 Using Symbolic Links for Databases on Windows">
Section 10.12.2.3, “Using Symbolic Links for Databases on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="webauthn-pluggable-authentication.html" title="8.4.1.11 WebAuthn Pluggable Authentication">
Section 8.4.1.11, “WebAuthn Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-postinstallation.html" title="2.3.5 Windows Postinstallation Procedures">
Section 2.3.5, “Windows Postinstallation Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="with.html" title="15.2.20 WITH (Common Table Expressions)">
Section 15.2.20, “WITH (Common Table Expressions)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="xml-functions.html" title="14.11 XML Functions">
Section 14.11, “XML Functions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql ...
</h3>
<dl>
<dt>
<a class="xref" href="compiling-for-debugging.html" title="7.9.1.1 Compiling MySQL for Debugging">
Section 7.9.1.1, “Compiling MySQL for Debugging”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql-test-run.pl
</h3>
<dl>
<dt>
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="lock-order-tool.html" title="7.9.3 The LOCK_ORDER Tool">
Section 7.9.3, “The LOCK_ORDER Tool”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-tips.html" title="6.5.1.6 mysql Client Tips">
Section 6.5.1.6, “mysql Client Tips”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql.server
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation.html" title="2.5 Installing MySQL on Linux">
Section 2.5, “Installing MySQL on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
Section 6.6.10, “mysqldumpslow — Summarize Slow Query Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="automatic-start.html" title="2.9.5 Starting and Stopping MySQL Automatically">
Section 2.9.5, “Starting and Stopping MySQL Automatically”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="timezone-problems.html" title="B.3.3.7 Time Zone Problems">
Section B.3.3.7, “Time Zone Problems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql.server stop
</h3>
<dl>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_config
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
Section 6.7.1, “mysql_config — Display Options for Compiling Clients”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_config_editor
</h3>
<dl>
<dt>
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="my-print-defaults.html" title="6.7.2 my_print_defaults — Display Options from Option Files">
Section 6.7.2, “my_print_defaults — Display Options from Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-general-options.html" title="6.6.4.1 myisamchk General Options">
Section 6.6.4.1, “myisamchk General Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
Section 6.6.8, “mysql_migrate_keyring — Keyring Key Migration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
Section 6.4.2, “mysql_secure_installation — Improve MySQL Installation Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
Section 6.5.5, “mysqlimport — A Data Import Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
Section 6.5.6, “mysqlshow — Display Database, Table, and Column Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
Section 6.5.7, “mysqlslap — A Load Emulation Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_migrate_keyring
</h3>
<dl>
<dt>
<a class="xref" href="keyring-options.html" title="8.4.4.15 Keyring Command Options">
Section 8.4.4.15, “Keyring Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keyring-key-migration.html" title="8.4.4.11 Migrating Keys Between Keyring Keystores">
Section 8.4.4.11, “Migrating Keys Between Keyring Keystores”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
Section 6.6.8, “mysql_migrate_keyring — Keyring Key Migration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_secure_installation
</h3>
<dl>
<dt>
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-native.html" title="2.5.7 Installing MySQL on Linux from the Native Software Repositories">
Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-debian.html" title="2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle">
Section 2.5.5, “Installing MySQL on Linux Using Debian Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation-pkg.html" title="2.7.1 Installing MySQL on Solaris Using a Solaris PKG">
Section 2.7.1, “Installing MySQL on Solaris Using a Solaris PKG”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
Section 6.4.2, “mysql_secure_installation — Improve MySQL Installation Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="default-privileges.html" title="2.9.4 Securing the Initial MySQL Account">
Section 2.9.4, “Securing the Initial MySQL Account”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_ssl_rsa_setup
</h3>
<dl>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_stmt_execute()
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_stmt_prepare()
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_tzinfo_to_sql
</h3>
<dl>
<dt>
<a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
Section 7.1.15, “MySQL Server Time Zone Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-tzinfo-to-sql.html" title="6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables">
Section 6.4.3, “mysql_tzinfo_to_sql — Load the Time Zone Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysql_upgrade
</h3>
<dl>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin
</h3>
<dl>
<dt>
<a class="xref" href="assigning-passwords.html" title="8.2.14 Assigning Account Passwords">
Section 8.2.14, “Assigning Account Passwords”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups-mysqldump.html" title="19.4.1.1 Backing Up a Replica Using mysqldump">
Section 19.4.1.1, “Backing Up a Replica Using mysqldump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
Section 15.1.12, “CREATE DATABASE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-installation-windows-path.html" title="2.3.3.7 Customizing the PATH for MySQL Tools">
Section 2.3.3.7, “Customizing the PATH for MySQL Tools”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="debugging-server.html" title="7.9.1 Debugging a MySQL Server">
Section 7.9.1, “Debugging a MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
Section 15.1.24, “DROP DATABASE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-notes.html" title="2.4.1 General Notes on Installing MySQL on macOS">
Section 2.4.1, “General Notes on Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-monitoring.html" title="20.4 Monitoring Group Replication">
Section 20.4, “Monitoring Group Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-cjk.html" title="A.11 MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean Character Sets">
Section A.11, “MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean
Character Sets”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-logs.html" title="7.4 MySQL Server Logs">
Section 7.4, “MySQL Server Logs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-multi.html" title="6.3.4 mysqld_multi — Manage Multiple MySQL Servers">
Section 6.3.4, “mysqld_multi — Manage Multiple MySQL Servers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-unix-servers.html" title="7.8.3 Running Multiple MySQL Instances on Unix">
Section 7.8.3, “Running Multiple MySQL Instances on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="default-privileges.html" title="2.9.4 Securing the Initial MySQL Account">
Section 2.9.4, “Securing the Initial MySQL Account”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-howto.html" title="19.1.3.4 Setting Up Replication Using GTIDs">
Section 19.1.3.4, “Setting Up Replication Using GTIDs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-command-line.html" title="2.3.3.6 Starting MySQL from the Windows Command Line">
Section 2.3.3.6, “Starting MySQL from the Windows Command Line”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-shutdown.html" title="7.1.19 The Server Shutdown Process">
Section 7.1.19, “The Server Shutdown Process”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-upgrading.html" title="3.11 Upgrading MySQL on Windows">
Section 3.11, “Upgrading MySQL on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="command-line-options.html" title="6.2.2.1 Using Options on the Command Line">
Section 6.2.2.1, “Using Options on the Command Line”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-usage.html" title="7.6.4.2 Using the Rewriter Query Rewrite Plugin">
Section 7.6.4.2, “Using the Rewriter Query Rewrite Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin debug
</h3>
<dl>
<dt>
<a class="xref" href="debugging-server.html" title="7.9.1 Debugging a MySQL Server">
Section 7.9.1, “Debugging a MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="events-status-info.html" title="27.4.5 Event Scheduler Status">
Section 27.4.5, “Event Scheduler Status”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin extended-status
</h3>
<dl>
<dt>
<a class="xref" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
Section 15.7.7.37, “SHOW STATUS Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-hosts
</h3>
<dl>
<dt>
<a class="xref" href="host-cache.html" title="7.1.12.3 DNS Lookups and the Host Cache">
Section 7.1.12.3, “DNS Lookups and the Host Cache”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-logs
</h3>
<dl>
<dt>
<a class="xref" href="backup-strategy-summary.html" title="9.3.3 Backup Strategy Summary">
Section 9.3.3, “Backup Strategy Summary”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-rotation.html" title="7.4.2.10 Error Log File Flushing and Renaming">
Section 7.4.2.10, “Error Log File Flushing and Renaming”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-policy.html" title="9.3.1 Establishing a Backup Policy">
Section 9.3.1, “Establishing a Backup Policy”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replica-logs-relaylog.html" title="19.2.4.1 The Relay Log">
Section 19.2.4.1, “The Relay Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-logs binary
</h3>
<dl>
<dt>
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-privileges
</h3>
<dl>
<dt>
<a class="xref" href="copying-databases.html" title="3.15 Copying MySQL Databases to Another Machine">
Section 3.15, “Copying MySQL Databases to Another Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="grant-tables.html" title="8.2.3 Grant Tables">
Section 8.2.3, “Grant Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks-recover.html" title="19.3.3.3 Recovering From Failed Replication Privilege Checks">
Section 19.3.3.3, “Recovering From Failed Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privilege-changes.html" title="8.2.13 When Privilege Changes Take Effect">
Section 8.2.13, “When Privilege Changes Take Effect”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-tables
</h3>
<dl>
<dt>
<a class="xref" href="optimizing-myisam-bulk-data-loading.html" title="10.6.2 Bulk Data Loading for MyISAM Tables">
Section 10.6.2, “Bulk Data Loading for MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="external-locking.html" title="10.11.5 External Locking">
Section 10.11.5, “External Locking”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-cache.html" title="10.4.3.1 How MySQL Opens and Closes Tables">
Section 10.4.3.1, “How MySQL Opens and Closes Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
Section 6.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-crash-recovery.html" title="9.6.1 Using myisamchk for Crash Recovery">
Section 9.6.1, “Using myisamchk for Crash Recovery”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin flush-xxx
</h3>
<dl>
<dt>
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin kill
</h3>
<dl>
<dt>
<a class="xref" href="full-disk.html" title="B.3.3.4 How MySQL Handles a Full Disk">
Section B.3.3.4, “How MySQL Handles a Full Disk”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="locking-functions.html" title="14.14 Locking Functions">
Section 14.14, “Locking Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="gone-away.html" title="B.3.2.7 MySQL server has gone away">
Section B.3.2.7, “MySQL server has gone away”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin password
</h3>
<dl>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin processlist
</h3>
<dl>
<dt>
<a class="xref" href="processlist-access.html" title="10.14.1 Accessing the Process List">
Section 10.14.1, “Accessing the Process List”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin processlist status
</h3>
<dl>
<dt>
<a class="xref" href="debugging-server.html" title="7.9.1 Debugging a MySQL Server">
Section 7.9.1, “Debugging a MySQL Server”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin refresh
</h3>
<dl>
<dt>
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-cache.html" title="10.4.3.1 How MySQL Opens and Closes Tables">
Section 10.4.3.1, “How MySQL Opens and Closes Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin reload
</h3>
<dl>
<dt>
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="grant-tables.html" title="8.2.3 Grant Tables">
Section 8.2.3, “Grant Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks-recover.html" title="19.3.3.3 Recovering From Failed Replication Privilege Checks">
Section 19.3.3.3, “Recovering From Failed Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="user-resources.html" title="8.2.21 Setting Account Resource Limits">
Section 8.2.21, “Setting Account Resource Limits”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privilege-changes.html" title="8.2.13 When Privilege Changes Take Effect">
Section 8.2.13, “When Privilege Changes Take Effect”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin reload version
</h3>
<dl>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin shutdown
</h3>
<dl>
<dt>
<a class="xref" href="request-access.html" title="8.2.7 Access Control, Stage 2: Request Verification">
Section 8.2.7, “Access Control, Stage 2: Request Verification”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="making-trace-files.html" title="7.9.1.2 Creating Trace Files">
Section 7.9.1.2, “Creating Trace Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="changing-mysql-user.html" title="8.1.5 How to Run MySQL as a Normal User">
Section 8.1.5, “How to Run MySQL as a Normal User”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-pkg.html" title="2.4.2 Installing MySQL on macOS Using Native Packages">
Section 2.4.2, “Installing MySQL on macOS Using Native Packages”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reproducible-test-case.html" title="7.9.1.7 Making a Test Case If You Experience Table Corruption">
Section 7.9.1.7, “Making a Test Case If You Experience Table Corruption”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-temptables.html" title="19.5.1.31 Replication and Temporary Tables">
Section 19.5.1.31, “Replication and Temporary Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="shutdown.html" title="15.7.8.9 SHUTDOWN Statement">
Section 15.7.8.9, “SHUTDOWN Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-shutdown.html" title="7.1.19 The Server Shutdown Process">
Section 7.1.19, “The Server Shutdown Process”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-upgrading-member.html" title="20.8.3.2 Upgrading a Group Replication Member">
Section 20.8.3.2, “Upgrading a Group Replication Member”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin status
</h3>
<dl>
<dt>
<a class="xref" href="table-cache.html" title="10.4.3.1 How MySQL Opens and Closes Tables">
Section 10.4.3.1, “How MySQL Opens and Closes Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin variables
</h3>
<dl>
<dt>
<a class="xref" href="gone-away.html" title="B.3.2.7 MySQL server has gone away">
Section B.3.2.7, “MySQL server has gone away”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
Section 15.7.7.41, “SHOW VARIABLES Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin variables extended-status processlist
</h3>
<dl>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin ver
</h3>
<dl>
<dt>
<a class="xref" href="compiling-for-debugging.html" title="7.9.1.1 Compiling MySQL for Debugging">
Section 7.9.1.1, “Compiling MySQL for Debugging”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqladmin version
</h3>
<dl>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="gone-away.html" title="B.3.2.7 MySQL server has gone away">
Section B.3.2.7, “MySQL server has gone away”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlanalyze
</h3>
<dl>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlbackup
</h3>
<dl>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-upgrade-with-mysqlbackup.html" title="20.8.3.4 Group Replication Upgrade with mysqlbackup">
Section 20.8.3.4, “Group Replication Upgrade with mysqlbackup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-backup.html" title="17.18.1 InnoDB Backup">
Section 17.18.1, “InnoDB Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-failover.html" title="19.1.3.5 Using GTIDs for Failover and Scaleout">
Section 19.1.3.5, “Using GTIDs for Failover and Scaleout”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-enterprise-backup.html" title="20.5.6 Using MySQL Enterprise Backup with Group Replication">
Section 20.5.6, “Using MySQL Enterprise Backup with Group Replication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlbinlog
</h3>
<dl>
<dt>
<a class="xref" href="replication-sbr-rbr.html" title="19.2.1.1 Advantages and Disadvantages of Statement-Based and Row-Based Replication">
Section 19.2.1.1, “Advantages and Disadvantages of Statement-Based and Row-Based
Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log-transaction-compression.html" title="7.4.4.5 Binary Log Transaction Compression">
Section 7.4.4.5, “Binary Log Transaction Compression”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binlog.html" title="15.7.8.1 BINLOG Statement">
Section 15.7.8.1, “BINLOG Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-delayed.html" title="19.4.11 Delayed Replication">
Section 19.4.11, “Delayed Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-binlog-encryption.html" title="19.3.2 Encrypting Binary Log Files and Relay Log Files">
Section 19.3.2, “Encrypting Binary Log Files and Relay Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-concepts.html" title="19.1.3.1 GTID Format and Storage">
Section 19.1.3.1, “GTID Format and Storage”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-lifecycle.html" title="19.1.3.2 GTID Life Cycle">
Section 19.1.3.2, “GTID Life Cycle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-bugs.html" title="19.5.5 How to Report Replication Bugs or Problems">
Section 19.5.5, “How to Report Replication Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-recovery.html" title="17.18.2 InnoDB Recovery">
Section 17.18.2, “InnoDB Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invisible-columns.html" title="15.1.20.10 Invisible Columns">
Section 15.1.20.10, “Invisible Columns”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="known-issues.html" title="B.3.7 Known Issues in MySQL">
Section B.3.7, “Known Issues in MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="miscellaneous-functions.html" title="14.23 Miscellaneous Functions">
Section 14.23, “Miscellaneous Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log-transaction-compression.html#binary-log-transaction-compression-monitoring" title="7.4.4.5.3 Monitoring Binary Log Transaction Compression">
Section 7.4.4.5.3, “Monitoring Binary Log Transaction Compression”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-hexdump.html" title="6.6.9.1 mysqlbinlog Hex Dump Format">
Section 6.6.9.1, “mysqlbinlog Hex Dump Format”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-row-events.html" title="6.6.9.2 mysqlbinlog Row Event Display">
Section 6.6.9.2, “mysqlbinlog Row Event Display”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-mta.html" title="25.7.11 NDB Cluster Replication Using the Multithreaded Applier">
Section 25.7.11, “NDB Cluster Replication Using the Multithreaded Applier”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="partitioning-info.html" title="26.3.5 Obtaining Information About Partitions">
Section 26.3.5, “Obtaining Information About Partitions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="point-in-time-recovery-binlog.html" title="9.5.1 Point-in-Time Recovery Using Binary Log">
Section 9.5.1, “Point-in-Time Recovery Using Binary Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="point-in-time-recovery-positions.html" title="9.5.2 Point-in-Time Recovery Using Event Positions">
Section 9.5.2, “Point-in-Time Recovery Using Event Positions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks-account.html" title="19.3.3.1 Privileges For The Replication PRIVILEGE_CHECKS_USER Account">
Section 19.3.3.1, “Privileges For The Replication PRIVILEGE_CHECKS_USER Account”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks-recover.html" title="19.3.3.3 Recovering From Failed Replication Privilege Checks">
Section 19.3.3.3, “Recovering From Failed Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-load-data.html" title="19.5.1.19 Replication and LOAD DATA">
Section 19.5.1.19, “Replication and LOAD DATA”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-variables.html" title="19.5.1.39 Replication and Variables">
Section 19.5.1.39, “Replication and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-binlog-encryption-scope.html" title="19.3.2.1 Scope of Binary Log Encryption">
Section 19.3.2.1, “Scope of Binary Log Encryption”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data-local-security.html" title="8.1.6 Security Considerations for LOAD DATA LOCAL">
Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
Section 15.7.7.3, “SHOW BINLOG EVENTS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-relaylog-events.html" title="15.7.7.34 SHOW RELAYLOG EVENTS Statement">
Section 15.7.7.34, “SHOW RELAYLOG EVENTS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-administration-skip.html" title="19.1.7.3 Skipping Transactions">
Section 19.1.7.3, “Skipping Transactions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-server-id.html" title="6.6.9.4 Specifying the mysqlbinlog Server ID">
Section 6.6.9.4, “Specifying the mysqlbinlog Server ID”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
Section 15.4.2.4, “START REPLICA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replica-logs-relaylog.html" title="19.2.4.1 The Relay Log">
Section 19.2.4.1, “The Relay Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-rbr-usage.html" title="19.2.1.2 Usage of Row-Based Logging and Replication">
Section 19.2.1.2, “Usage of Row-Based Logging and Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="recovery-from-backups.html" title="9.3.2 Using Backups for Recovery">
Section 9.3.2, “Using Backups for Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-failover.html" title="19.1.3.5 Using GTIDs for Failover and Scaleout">
Section 19.1.3.5, “Using GTIDs for Failover and Scaleout”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-backup.html" title="6.6.9.3 Using mysqlbinlog to Back Up Binary Log Files">
Section 6.6.9.3, “Using mysqlbinlog to Back Up Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-usage.html" title="7.6.4.2 Using the Rewriter Query Rewrite Plugin">
Section 7.6.4.2, “Using the Rewriter Query Rewrite Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlbinlog binary-log-file | mysql
</h3>
<dl>
<dt>
<a class="xref" href="reproducible-test-case.html" title="7.9.1.7 Making a Test Case If You Experience Table Corruption">
Section 7.9.1.7, “Making a Test Case If You Experience Table Corruption”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlbinlog|mysql
</h3>
<dl>
<dt>
<a class="xref" href="known-issues.html" title="B.3.7 Known Issues in MySQL">
Section B.3.7, “Known Issues in MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlcheck
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="my-print-defaults.html" title="6.7.2 my_print_defaults — Display Options from Option Files">
Section 6.7.2, “my_print_defaults — Display Options from Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-maintenance.html" title="9.6 MyISAM Table Maintenance and Crash Recovery">
Section 9.6, “MyISAM Table Maintenance and Crash Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrade-prerequisites.html" title="3.6 Preparing Your Installation for Upgrade">
Section 3.6, “Preparing Your Installation for Upgrade”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rebuilding-tables.html" title="3.14 Rebuilding or Repairing Tables or Indexes">
Section 3.14, “Rebuilding or Repairing Tables or Indexes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
Section 18.2, “The MyISAM Storage Engine”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="alter-database.html" title="15.1.2 ALTER DATABASE Statement">
Section 15.1.2, “ALTER DATABASE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-scan-avoidance.html" title="10.2.1.23 Avoiding Full Table Scans">
Section 10.2.1.23, “Avoiding Full Table Scans”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-getting-started.html" title="2.5.6.1 Basic Steps for MySQL Server Deployment with Docker">
Section 2.5.6.1, “Basic Steps for MySQL Server Deployment with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log-transaction-compression.html" title="7.4.4.5 Binary Log Transaction Compression">
Section 7.4.4.5, “Binary Log Transaction Compression”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log-formats.html" title="7.4.4.1 Binary Logging Formats">
Section 7.4.4.1, “Binary Logging Formats”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cannot-create.html" title="B.3.2.11 Can't create/write to file">
Section B.3.2.11, “Can't create/write to file”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cannot-initialize-character-set.html" title="B.3.2.15 Can't initialize character set">
Section B.3.2.15, “Can't initialize character set”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
Section 15.4.2.1, “CHANGE REPLICATION FILTER Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="comments.html" title="11.7 Comments">
Section 11.7, “Comments”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="communication-errors.html" title="B.3.2.9 Communication Errors and Aborted Connections">
Section B.3.2.9, “Communication Errors and Aborted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="comp-err.html" title="6.4.1 comp_err — Compile MySQL Error Message File">
Section 6.4.1, “comp_err — Compile MySQL Error Message File”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compiling-for-debugging.html" title="7.9.1.1 Compiling MySQL for Debugging">
Section 7.9.1.1, “Compiling MySQL for Debugging”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-configuration.html" title="25.4 Configuration of NDB Cluster">
Section 25.4, “Configuration of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-ssl-library-configuration.html" title="2.8.6 Configuring SSL Library Support">
Section 2.8.6, “Configuring SSL Library Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="corrupted-myisam-tables.html" title="18.2.4.1 Corrupted MyISAM Tables">
Section 18.2.4.1, “Corrupted MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="making-trace-files.html" title="7.9.1.2 Creating Trace Files">
Section 7.9.1.2, “Creating Trace Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-deadlocks.html" title="17.7.5 Deadlocks in InnoDB">
Section 17.7.5, “Deadlocks in InnoDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="debugging-server.html" title="7.9.1 Debugging a MySQL Server">
Section 7.9.1, “Debugging a MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-gdb-on-mysqld.html" title="7.9.1.4 Debugging mysqld under gdb">
Section 7.9.1.4, “Debugging mysqld under gdb”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-destination-configuration.html" title="7.4.2.2 Default Error Log Destination Configuration">
Section 7.4.2.2, “Default Error Log Destination Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-api-definition.html" title="25.4.3.7 Defining SQL and Other API Nodes in an NDB Cluster">
Section 25.4.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="host-cache.html" title="7.1.12.3 DNS Lookups and the Host Cache">
Section 7.1.12.3, “DNS Lookups and the Host Cache”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-doublewrite-buffer.html" title="17.6.4 Doublewrite Buffer">
Section 17.6.4, “Doublewrite Buffer”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-enabling-monitors.html" title="17.17.2 Enabling InnoDB Monitors">
Section 17.17.2, “Enabling InnoDB Monitors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="large-page-support.html" title="10.12.3.3 Enabling Large Page Support">
Section 10.12.3.3, “Enabling Large Page Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="engine-condition-pushdown-optimization.html" title="10.2.1.5 Engine Condition Pushdown Optimization">
Section 10.2.1.5, “Engine Condition Pushdown Optimization”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-event-fields.html" title="7.4.2.3 Error Event Fields">
Section 7.4.2.3, “Error Event Fields”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-rotation.html" title="7.4.2.10 Error Log File Flushing and Renaming">
Section 7.4.2.10, “Error Log File Flushing and Renaming”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-format.html" title="7.4.2.9 Error Log Output Format">
Section 7.4.2.9, “Error Log Output Format”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-syslog.html" title="7.4.2.8 Error Logging to the System Log">
Section 7.4.2.8, “Error Logging to the System Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-logs-event-buffer.html" title="25.6.2.3 Event Buffer Reporting in the Cluster Log">
Section 25.6.2.3, “Event Buffer Reporting in the Cluster Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-buffer-pool-in-core-file.html" title="17.8.3.7 Excluding or Including Buffer Pool Pages from Core Files">
Section 17.8.3.7, “Excluding or Including Buffer Pool Pages from Core Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="external-locking.html" title="10.11.5 External Locking">
Section 10.11.5, “External Locking”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-file-per-table-tablespaces.html" title="17.6.3.2 File-Per-Table Tablespaces">
Section 17.6.3.2, “File-Per-Table Tablespaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="fulltext-fine-tuning.html" title="14.9.6 Fine-Tuning MySQL Full-Text Search">
Section 14.9.6, “Fine-Tuning MySQL Full-Text Search”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="forcing-innodb-recovery.html" title="17.20.3 Forcing InnoDB Recovery">
Section 17.20.3, “Forcing InnoDB Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-general-info.html" title="25.1 General Information">
Section 25.1, “General Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-general.html" title="25.7.2 General Requirements for NDB Cluster Replication">
Section 25.7.2, “General Requirements for NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="general-thread-states.html" title="10.14.3 General Thread States">
Section 10.14.3, “General Thread States”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="changing-mysql-user.html" title="8.1.5 How to Run MySQL as a Normal User">
Section 8.1.5, “How to Run MySQL as a Normal User”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="ignoring-user.html" title="B.3.2.13 Ignoring user">
Section B.3.2.13, “Ignoring user”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-failover.html" title="25.7.8 Implementing Failover with NDB Cluster Replication">
Section 25.7.8, “Implementing Failover with NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-functions.html" title="14.15 Information Functions">
Section 14.15, “Information Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-backup.html" title="17.18.1 InnoDB Backup">
Section 17.18.1, “InnoDB Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-disk-io.html" title="17.11.1 InnoDB Disk I/O">
Section 17.11.1, “InnoDB Disk I/O”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-init-startup-configuration.html" title="17.8.1 InnoDB Startup Configuration">
Section 17.8.1, “InnoDB Startup Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-troubleshooting.html" title="17.20 InnoDB Troubleshooting">
Section 17.20, “InnoDB Troubleshooting”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
Section 15.2.7.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="insert.html" title="15.2.7 INSERT Statement">
Section 15.2.7, “INSERT Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux.html" title="25.3.1 Installation of NDB Cluster on Linux">
Section 25.3.1, “Installation of NDB Cluster on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-pkg.html" title="2.4.2 Installing MySQL on macOS Using Native Packages">
Section 2.4.2, “Installing MySQL on macOS Using Native Packages”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-installation.html" title="2.3 Installing MySQL on Microsoft Windows">
Section 2.3, “Installing MySQL on Microsoft Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-limitations-exclusive-to-cluster.html" title="25.2.7.8 Issues Exclusive to NDB Cluster">
Section 25.2.7.8, “Issues Exclusive to NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keyring-component-installation.html" title="8.4.4.2 Keyring Component Installation">
Section 8.4.4.2, “Keyring Component Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-issues.html" title="25.7.3 Known Issues in NDB Cluster Replication">
Section 25.7.3, “Known Issues in NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
Section 15.3.6, “LOCK TABLES and UNLOCK TABLES Statements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="locking-functions.html" title="14.14 Locking Functions">
Section 14.14, “Locking Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reproducible-test-case.html" title="7.9.1.7 Making a Test Case If You Experience Table Corruption">
Section 7.9.1.7, “Making a Test Case If You Experience Table Corruption”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-management.html" title="25.6 Management of NDB Cluster">
Section 25.6, “Management of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keyring-key-migration.html" title="8.4.4.11 Migrating Keys Between Keyring Keystores">
Section 8.4.4.11, “Migrating Keys Between Keyring Keystores”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="miscellaneous-functions.html" title="14.23 Miscellaneous Functions">
Section 14.23, “Miscellaneous Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log-mixed.html" title="7.4.4.3 Mixed Binary Logging Format">
Section 7.4.4.3, “Mixed Binary Logging Format”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-migration.html" title="17.6.1.4 Moving or Copying InnoDB Tables">
Section 17.6.1.4, “Moving or Copying InnoDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-start.html" title="18.2.1 MyISAM Startup Options">
Section 18.2.1, “MyISAM Startup Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-check-options.html" title="6.6.4.2 myisamchk Check Options">
Section 6.6.4.2, “myisamchk Check Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk-general-options.html" title="6.6.4.1 myisamchk General Options">
Section 6.6.4.1, “myisamchk General Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
Section 6.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-general.html" title="A.1 MySQL 8.4 FAQ: General">
Section A.1, “MySQL 8.4 FAQ: General”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-cjk.html" title="A.11 MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean Character Sets">
Section A.11, “MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean
Character Sets”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-sql-modes.html" title="A.3 MySQL 8.4 FAQ: Server SQL Mode">
Section A.3, “MySQL 8.4 FAQ: Server SQL Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-tips.html" title="6.5.1.6 mysql Client Tips">
Section 6.5.1.6, “mysql Client Tips”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-administration.html" title="Chapter 7 MySQL Server Administration">
Chapter 7,
<i>
MySQL Server Administration
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="gone-away.html" title="B.3.2.7 MySQL server has gone away">
Section B.3.2.7, “MySQL server has gone away”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-logs.html" title="7.4 MySQL Server Logs">
Section 7.4, “MySQL Server Logs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-program-options-mysqld" title="25.4.3.9.1 MySQL Server Options for NDB Cluster">
Section 25.4.3.9.1, “MySQL Server Options for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
Section 7.1.15, “MySQL Server Time Zone Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mysqld.html" title="25.6.10 MySQL Server Usage for NDB Cluster">
Section 25.6.10, “MySQL Server Usage for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-compared.html" title="25.2.6 MySQL Server Using InnoDB Compared with NDB Cluster">
Section 25.2.6, “MySQL Server Using InnoDB Compared with NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compatibility.html" title="1.7 MySQL Standards Compliance">
Section 1.7, “MySQL Standards Compliance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
Chapter 30,
<i>
MySQL sys Schema
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
Section 6.3.1, “mysqld — The MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-multi.html" title="6.3.4 mysqld_multi — Manage Multiple MySQL Servers">
Section 6.3.4, “mysqld_multi — Manage Multiple MySQL Servers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-mysql-security-procedures.html" title="25.6.21.3 NDB Cluster and MySQL Security Procedures">
Section 25.6.21.3, “NDB Cluster and MySQL Security Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-config-example.html" title="25.4.3.1 NDB Cluster Configuration: Basic Example">
Section 25.4.3.1, “NDB Cluster Configuration: Basic Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-installation.html" title="25.3 NDB Cluster Installation">
Section 25.3, “NDB Cluster Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-option-tables.html" title="25.4.2.5 NDB Cluster mysqld Option and Variable Reference">
Section 25.4.2.5, “NDB Cluster mysqld Option and Variable Reference”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-overview.html" title="25.2 NDB Cluster Overview">
Section 25.2, “NDB Cluster Overview”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication.html" title="25.7 NDB Cluster Replication">
Section 25.7, “NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-schema.html" title="25.7.4 NDB Cluster Replication Schema and Tables">
Section 25.7.4, “NDB Cluster Replication Schema and Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-mta.html" title="25.7.11 NDB Cluster Replication Using the Multithreaded Applier">
Section 25.7.11, “NDB Cluster Replication Using the Multithreaded Applier”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-multi-source.html" title="25.7.10 NDB Cluster Replication: Bidirectional and Circular Replication">
Section 25.7.10, “NDB Cluster Replication: Bidirectional and Circular Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
Section 25.5.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
Section 25.5.27, “ndb_show_tables — Display List of NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-top.html" title="25.5.30 ndb_top — View CPU usage information for NDB threads">
Section 25.5.30, “ndb_top — View CPU usage information for NDB threads”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo.html" title="25.6.17 ndbinfo: The NDB Cluster Information Database">
Section 25.6.17, “ndbinfo: The NDB Cluster Information Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-limitations-syntax.html" title="25.2.7.1 Noncompliance with SQL Syntax in NDB Cluster">
Section 25.2.7.1, “Noncompliance with SQL Syntax in NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-operations.html" title="25.6.12 Online Operations with ALTER TABLE in NDB Cluster">
Section 25.6.12, “Online Operations with ALTER TABLE in NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
Section 15.7.3.4, “OPTIMIZE TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimizer-issues.html" title="B.3.5 Optimizer-Related Issues">
Section B.3.5, “Optimizer-Related Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimizing-innodb-logging.html" title="10.5.4 Optimizing InnoDB Redo Logging">
Section 10.5.4, “Optimizing InnoDB Redo Logging”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-added-deprecated-removed.html" title="25.2.5 Options, Variables, and Parameters Added, Deprecated or Removed in NDB 8.4">
Section 25.2.5, “Options, Variables, and Parameters Added, Deprecated or Removed in NDB
8.4”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-configuration-overview.html" title="25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables">
Section 25.4.2, “Overview of NDB Cluster Configuration Parameters, Options, and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="packet-too-large.html" title="B.3.2.8 Packet Too Large">
Section B.3.2.8, “Packet Too Large”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-startup-configuration.html" title="29.3 Performance Schema Startup Configuration">
Section 29.3, “Performance Schema Startup Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
Section 29.12.14.2, “Performance Schema variables_info Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-preparation.html" title="25.7.5 Preparing the NDB Cluster for Replication">
Section 25.7.5, “Preparing the NDB Cluster for Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-table-close.html" title="18.2.4.2 Problems from Tables Not Being Closed Properly">
Section 18.2.4.2, “Problems from Tables Not Being Closed Properly”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="file-permissions.html" title="B.3.3.1 Problems with File Permissions">
Section B.3.3.1, “Problems with File Permissions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-modifiers.html" title="6.2.2.4 Program Option Modifiers">
Section 6.2.2.4, “Program Option Modifiers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
Section 15.7.3.5, “REPAIR TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-reference.html" title="19.1.6.1 Replication and Binary Logging Option and Variable Reference">
Section 19.1.6.1, “Replication and Binary Logging Option and Variable Reference”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options.html" title="19.1.6 Replication and Binary Logging Options and Variables">
Section 19.1.6, “Replication and Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-shutdowns.html" title="19.5.1.28 Replication and Source or Replica Shutdowns">
Section 19.5.1.28, “Replication and Source or Replica Shutdowns”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-transaction-inconsistencies.html" title="19.5.1.34 Replication and Transaction Inconsistencies">
Section 19.5.1.34, “Replication and Transaction Inconsistencies”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replica-logs-status.html" title="19.2.4.2 Replication Metadata Repositories">
Section 19.2.4.2, “Replication Metadata Repositories”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-source.html" title="19.1.6.2 Replication Source Options and Variables">
Section 19.1.6.2, “Replication Source Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resetting-permissions.html#resetting-permissions-unix" title="B.3.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems">
Section B.3.3.2.2, “Resetting the Root Password: Unix and Unix-Like Systems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resetting-permissions.html#resetting-permissions-windows" title="B.3.3.2.1 Resetting the Root Password: Windows Systems">
Section B.3.3.2.1, “Resetting the Root Password: Windows Systems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resource-groups.html" title="7.1.16 Resource Groups">
Section 7.1.16, “Resource Groups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
Section 15.7.8.8, “RESTART Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="nontransactional-tables.html" title="B.3.4.5 Rollback Failure for Nontransactional Tables">
Section B.3.4.5, “Rollback Failure for Nontransactional Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-servers.html" title="7.8 Running Multiple MySQL Instances on One Machine">
Section 7.8, “Running Multiple MySQL Instances on One Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="default-privileges.html" title="2.9.4 Securing the Initial MySQL Account">
Section 2.9.4, “Securing the Initial MySQL Account”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data-local-security.html" title="8.1.6 Security Considerations for LOAD DATA LOCAL">
Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-options.html" title="8.1.4 Security-Related mysqld Options and Variables">
Section 8.1.4, “Security-Related mysqld Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
Section 15.2.13.1, “SELECT ... INTO Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-select-server.html" title="2.3.3.3 Selecting a MySQL Server Type">
Section 2.3.3.3, “Selecting a MySQL Server Type”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux.html" title="8.7 SELinux">
Section 8.7, “SELinux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-server.html" title="6.3 Server and Server-Startup Programs">
Section 6.3, “Server and Server-Startup Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-server.html" title="12.3.2 Server Character Set and Collation">
Section 12.3.2, “Server Character Set and Collation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-message-language.html" title="12.12 Setting the Error Message Language">
Section 12.12, “Setting the Error Message Language”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux-context-mysql-feature-ports.html" title="8.7.5.2 Setting the TCP Port Context for MySQL Features">
Section 8.7.5.2, “Setting the TCP Port Context for MySQL Features”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux-context-mysqld-tcp-port.html" title="8.7.5.1 Setting the TCP Port Context for mysqld">
Section 8.7.5.1, “Setting the TCP Port Context for mysqld”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-maintenance-schedule.html" title="9.6.5 Setting Up a MyISAM Table Maintenance Schedule">
Section 9.6.5, “Setting Up a MyISAM Table Maintenance Schedule”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-howto.html" title="19.1.3.4 Setting Up Replication Using GTIDs">
Section 19.1.3.4, “Setting Up Replication Using GTIDs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
Section 15.7.7.16, “SHOW ENGINE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="program-options.html" title="6.2.2 Specifying Program Options">
Section 6.2.2, “Specifying Program Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
Section 15.4.2.4, “START REPLICA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="automatic-start.html" title="2.9.5 Starting and Stopping MySQL Automatically">
Section 2.9.5, “Starting and Stopping MySQL Automatically”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-command-line-servers.html" title="7.8.2.1 Starting Multiple MySQL Instances at the Windows Command Line">
Section 7.8.2.1, “Starting Multiple MySQL Instances at the Windows Command Line”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-command-line.html" title="2.3.3.6 Starting MySQL from the Windows Command Line">
Section 2.3.3.6, “Starting MySQL from the Windows Command Line”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-starting.html" title="25.7.6 Starting NDB Cluster Replication (Single Replication Channel)">
Section 25.7.6, “Starting NDB Cluster Replication (Single Replication Channel)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="channels-startup-options.html" title="19.2.2.3 Startup Options and Replication Channels">
Section 19.2.2.3, “Startup Options and Replication Channels”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-switch.html" title="19.4.8 Switching Sources During Failover">
Section 19.4.8, “Switching Sources During Failover”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-locking.html" title="10.11.2 Table Locking Issues">
Section 10.11.2, “Table Locking Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="table-corruption.html" title="B.3.2.17 Table-Corruption Issues">
Section B.3.2.17, “Table-Corruption Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-testing.html" title="2.3.3.9 Testing The MySQL Installation">
Section 2.3.3.9, “Testing The MySQL Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="blackhole-storage-engine.html" title="18.6 The BLACKHOLE Storage Engine">
Section 18.6, “The BLACKHOLE Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="dbug-package.html" title="7.9.4 The DBUG Package">
Section 7.9.4, “The DBUG Package”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
Section 18.2, “The MyISAM Storage Engine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-server.html" title="7.1 The MySQL Server">
Section 7.1, “The MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-operations-per-fragment.html" title="25.6.17.49 The ndbinfo operations_per_fragment Table">
Section 25.6.17.49, “The ndbinfo operations_per_fragment Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-server-locks.html" title="25.6.17.54 The ndbinfo server_locks Table">
Section 25.6.17.54, “The ndbinfo server_locks Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
Section 29.12.2.3, “The setup_instruments Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="timezone-problems.html" title="B.3.3.7 Time Zone Problems">
Section B.3.3.7, “Time Zone Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="too-many-connections.html" title="B.3.2.5 Too many connections">
Section B.3.2.5, “Too many connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-troubleshooting.html" title="2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation">
Section 2.3.4, “Troubleshooting a Microsoft Windows MySQL Server Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-creating-innodb.html" title="17.20.1 Troubleshooting InnoDB I/O Problems">
Section 17.20.1, “Troubleshooting InnoDB I/O Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="starting-server-troubleshooting.html" title="2.9.2.1 Troubleshooting Problems Starting the MySQL Server">
Section 2.9.2.1, “Troubleshooting Problems Starting the MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="unix-signal-response.html" title="6.10 Unix Signal Handling in MySQL">
Section 6.10, “Unix Signal Handling in MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrade-troubleshooting.html" title="3.13 Upgrade Troubleshooting">
Section 3.13, “Upgrade Troubleshooting”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrade-binary-package.html" title="3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux">
Section 3.7, “Upgrading MySQL Binary or Package-based Installations on Unix/Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-upgrading.html" title="3.11 Upgrading MySQL on Windows">
Section 3.11, “Upgrading MySQL on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-stack-trace.html" title="7.9.1.5 Using a Stack Trace">
Section 7.9.1.5, “Using a Stack Trace”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-crash-recovery.html" title="9.6.1 Using myisamchk for Crash Recovery">
Section 9.6.1, “Using myisamchk for Crash Recovery”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-log-files.html" title="7.9.1.6 Using Server Logs to Find Causes of Errors in mysqld">
Section 7.9.1.6, “Using Server Logs to Find Causes of Errors in mysqld”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-symbolic-links.html" title="10.12.2.3 Using Symbolic Links for Databases on Windows">
Section 10.12.2.3, “Using Symbolic Links for Databases on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="symbolic-links-to-tables.html" title="10.12.2.2 Using Symbolic Links for MyISAM Tables on Unix">
Section 10.12.2.2, “Using Symbolic Links for MyISAM Tables on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-two-channels.html" title="25.7.7 Using Two Replication Channels for NDB Cluster Replication">
Section 25.7.7, “Using Two Replication Channels for NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="making-windows-dumps.html" title="7.9.1.3 Using WER with PDB to create a Windows crashdump">
Section 7.9.1.3, “Using WER with PDB to create a Windows crashdump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privilege-changes.html" title="8.2.13 When Privilege Changes Take Effect">
Section 8.2.13, “When Privilege Changes Take Effect”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="temporary-files.html" title="B.3.3.5 Where MySQL Stores Temporary Files">
Section B.3.3.5, “Where MySQL Stores Temporary Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="which-version.html" title="2.1.2 Which MySQL Version and Distribution to Install">
Section 2.1.2, “Which MySQL Version and Distribution to Install”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld mysqld.trace
</h3>
<dl>
<dt>
<a class="xref" href="making-trace-files.html" title="7.9.1.2 Creating Trace Files">
Section 7.9.1.2, “Creating Trace Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld-auto.cnf
</h3>
<dl>
<dt>
<a class="xref" href="program-options.html" title="6.2.2 Specifying Program Options">
Section 6.2.2, “Specifying Program Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld-debug
</h3>
<dl>
<dt>
<a class="xref" href="making-trace-files.html" title="7.9.1.2 Creating Trace Files">
Section 7.9.1.2, “Creating Trace Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
Section 6.3.1, “mysqld — The MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-select-server.html" title="2.3.3.3 Selecting a MySQL Server Type">
Section 2.3.3.3, “Selecting a MySQL Server Type”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld_multi
</h3>
<dl>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-multi.html" title="6.3.4 mysqld_multi — Manage Multiple MySQL Servers">
Section 6.3.4, “mysqld_multi — Manage Multiple MySQL Servers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-unix-servers.html" title="7.8.3 Running Multiple MySQL Instances on Unix">
Section 7.8.3, “Running Multiple MySQL Instances on Unix”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld_multi.server
</h3>
<dl>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqld_safe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="compiling-for-debugging.html" title="7.9.1.1 Compiling MySQL for Debugging">
Section 7.9.1.1, “Compiling MySQL for Debugging”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-destination-configuration.html" title="7.4.2.2 Default Error Log Destination Configuration">
Section 7.4.2.2, “Default Error Log Destination Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-with-mysql-sock.html" title="B.3.3.6 How to Protect or Change the MySQL Unix Socket File">
Section B.3.3.6, “How to Protect or Change the MySQL Unix Socket File”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-troubleshooting.html" title="17.20 InnoDB Troubleshooting">
Section 17.20, “InnoDB Troubleshooting”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="security-against-attack.html" title="8.1.3 Making MySQL Secure Against Attackers">
Section 8.1.3, “Making MySQL Secure Against Attackers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
Section 7.1.15, “MySQL Server Time Zone Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-multi.html" title="6.3.4 mysqld_multi — Manage Multiple MySQL Servers">
Section 6.3.4, “mysqld_multi — Manage Multiple MySQL Servers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-mysql-security-procedures.html" title="25.6.21.3 NDB Cluster and MySQL Security Procedures">
Section 25.6.21.3, “NDB Cluster and MySQL Security Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-defaults-equals.html" title="6.2.2.6 Option Defaults, Options Expecting Values, and the = Sign">
Section 6.2.2.6, “Option Defaults, Options Expecting Values, and the = Sign”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="packet-too-large.html" title="B.3.2.8 Packet Too Large">
Section B.3.2.8, “Packet Too Large”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
Section 29.12.14.2, “Performance Schema variables_info Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="file-permissions.html" title="B.3.3.1 Problems with File Permissions">
Section B.3.3.1, “Problems with File Permissions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
Section 15.7.8.8, “RESTART Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-servers.html" title="7.8 Running Multiple MySQL Instances on One Machine">
Section 7.8, “Running Multiple MySQL Instances on One Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-unix-servers.html" title="7.8.3 Running Multiple MySQL Instances on Unix">
Section 7.8.3, “Running Multiple MySQL Instances on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="automatic-start.html" title="2.9.5 Starting and Stopping MySQL Automatically">
Section 2.9.5, “Starting and Stopping MySQL Automatically”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="starting-server.html" title="2.9.2 Starting the Server">
Section 2.9.2, “Starting the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="timezone-problems.html" title="B.3.3.7 Time Zone Problems">
Section B.3.3.7, “Time Zone Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="starting-server-troubleshooting.html" title="2.9.2.1 Troubleshooting Problems Starting the MySQL Server">
Section 2.9.2.1, “Troubleshooting Problems Starting the MySQL Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrade-binary-package.html" title="3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux">
Section 3.7, “Upgrading MySQL Binary or Package-based Installations on Unix/Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqldump
</h3>
<dl>
<dt>
<a class="xref" href="alter-database.html" title="15.1.2 ALTER DATABASE Statement">
Section 15.1.2, “ALTER DATABASE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups-mysqldump.html" title="19.4.1.1 Backing Up a Replica Using mysqldump">
Section 19.4.1.1, “Backing Up a Replica Using mysqldump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups-read-only.html" title="19.4.1.3 Backing Up a Source or Replica by Making It Read Only">
Section 19.4.1.3, “Backing Up a Source or Replica by Making It Read Only”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-and-recovery.html" title="Chapter 9 Backup and Recovery">
Chapter 9,
<i>
Backup and Recovery
</i>
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-strategy-summary.html" title="9.3.3 Backup Strategy Summary">
Section 9.3.3, “Backup Strategy Summary”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-buffer-pool.html" title="17.5.1 Buffer Pool">
Section 17.5.1, “Buffer Pool”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="optimizing-innodb-bulk-data-loading.html" title="10.5.5 Bulk Data Loading for InnoDB Tables">
Section 10.5.5, “Bulk Data Loading for InnoDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html" title="19.1.2.5 Choosing a Method for Data Snapshots">
Section 19.1.2.5, “Choosing a Method for Data Snapshots”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting-using-uri-or-key-value-pairs.html" title="6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs">
Section 6.2.5, “Connecting to the Server Using URI-Like Strings or Key-Value Pairs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-unicode-conversion.html" title="12.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets">
Section 12.9.8, “Converting Between 3-Byte and 4-Byte Unicode Character Sets”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-copying-to-other-server.html" title="9.4.5.2 Copy a Database from one Server to Another">
Section 9.4.5.2, “Copy a Database from one Server to Another”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="copying-databases.html" title="3.15 Copying MySQL Databases to Another Machine">
Section 3.15, “Copying MySQL Databases to Another Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
Section 15.1.21, “CREATE TABLESPACE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-mysqldump" title="19.1.2.5.1 Creating a Data Snapshot Using mysqldump">
Section 19.1.2.5.1, “Creating a Data Snapshot Using mysqldump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-installation-windows-path.html" title="2.3.3.7 Customizing the PATH for MySQL Tools">
Section 2.3.3.7, “Customizing the PATH for MySQL Tools”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-dictionary-usage-differences.html" title="16.7 Data Dictionary Usage Differences">
Section 16.7, “Data Dictionary Usage Differences”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-methods.html" title="9.2 Database Backup Methods">
Section 9.2, “Database Backup Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-file-defragmenting.html" title="17.11.4 Defragmenting a Table">
Section 17.11.4, “Defragmenting a Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-delimited-text.html" title="9.4.3 Dumping Data in Delimited-Text Format with mysqldump">
Section 9.4.3, “Dumping Data in Delimited-Text Format with mysqldump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-sql-format.html" title="9.4.1 Dumping Data in SQL Format with mysqldump">
Section 9.4.1, “Dumping Data in SQL Format with mysqldump”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-stored-programs.html" title="9.4.5.3 Dumping Stored Programs">
Section 9.4.5.3, “Dumping Stored Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-definition-data-dumps.html" title="9.4.5.4 Dumping Table Definitions and Content Separately">
Section 9.4.5.4, “Dumping Table Definitions and Content Separately”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-policy.html" title="9.3.1 Establishing a Backup Policy">
Section 9.3.1, “Establishing a Backup Policy”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-strategy-example.html" title="9.3 Example Backup and Recovery Strategy">
Section 9.3, “Example Backup and Recovery Strategy”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table-foreign-keys.html" title="15.1.20.5 FOREIGN KEY Constraints">
Section 15.1.20.5, “FOREIGN KEY Constraints”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table-gipks.html" title="15.1.20.11 Generated Invisible Primary Keys">
Section 15.1.20.11, “Generated Invisible Primary Keys”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-options-gtids.html" title="19.1.6.5 Global Transaction ID System Variables">
Section 19.1.6.5, “Global Transaction ID System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="import-table.html" title="15.2.6 IMPORT TABLE Statement">
Section 15.2.6, “IMPORT TABLE Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-importing-data.html" title="25.6.9 Importing Data Into MySQL Cluster">
Section 25.6.9, “Importing Data Into MySQL Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innochecksum.html" title="6.6.2 innochecksum — Offline InnoDB File Checksum Utility">
Section 6.6.2, “innochecksum — Offline InnoDB File Checksum Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-backup.html" title="17.18.1 InnoDB Backup">
Section 17.18.1, “InnoDB Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="uln-installation.html" title="2.6 Installing MySQL Using Unbreakable Linux Network (ULN)">
Section 2.6, “Installing MySQL Using Unbreakable Linux Network (ULN)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invisible-columns.html" title="15.1.20.10 Invisible Columns">
Section 15.1.20.10, “Invisible Columns”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="kerberos-pluggable-authentication.html" title="8.4.1.8 Kerberos Pluggable Authentication">
Section 8.4.1.8, “Kerberos Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-xml.html" title="15.2.10 LOAD XML Statement">
Section 15.2.10, “LOAD XML Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-copying-database.html" title="9.4.5.1 Making a Copy of a Database">
Section 9.4.5.1, “Making a Copy of a Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="docker-mysql-more-topics.html" title="2.5.6.2 More Topics on Deploying MySQL Server with Docker">
Section 2.5.6.2, “More Topics on Deploying MySQL Server with Docker”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-migration.html" title="17.6.1.4 Moving or Copying InnoDB Tables">
Section 17.6.1.4, “Moving or Copying InnoDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="data-masking-components-installation.html" title="8.5.2.1 MySQL Enterprise Data Masking and De-Identification Component Installation">
Section 8.5.2.1, “MySQL Enterprise Data Masking and De-Identification Component Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-releases.html" title="1.3 MySQL Releases: Innovation and LTS">
Section 1.3, “MySQL Releases: Innovation and LTS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-configurator-workflow-server.html#server-existing-installations" title="2.3.2.1.1 MySQL Server Installations">
Section 2.3.2.1.1, “MySQL Server Installations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-logs.html" title="7.4 MySQL Server Logs">
Section 7.4, “MySQL Server Logs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump-tips.html" title="9.4.5 mysqldump Tips">
Section 9.4.5, “mysqldump Tips”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-example-data.html" title="25.3.5 NDB Cluster Example with Tables and Data">
Section 25.3.5, “NDB Cluster Example with Tables and Data”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-overview.html" title="25.2 NDB Cluster Overview">
Section 25.2, “NDB Cluster Overview”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo.html" title="25.6.17 ndbinfo: The NDB Cluster Information Database">
Section 25.6.17, “ndbinfo: The NDB Cluster Information Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-howto-masterstatus.html" title="19.1.2.4 Obtaining the Replication Source Binary Log Coordinates">
Section 19.1.2.4, “Obtaining the Replication Source Binary Log Coordinates”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup.html" title="25.6.8 Online Backup of NDB Cluster">
Section 25.6.8, “Online Backup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-preparation.html" title="25.7.5 Preparing the NDB Cluster for Replication">
Section 25.7.5, “Preparing the NDB Cluster for Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-with-float.html" title="B.3.4.8 Problems with Floating-Point Values">
Section B.3.4.8, “Problems with Floating-Point Values”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-multi-source-provision-replica.html" title="19.1.5.2 Provisioning a Multi-Source Replica for GTID-Based Replication">
Section 19.1.5.2, “Provisioning a Multi-Source Replica for GTID-Based Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-purge-configuration.html" title="17.8.9 Purge Configuration">
Section 17.8.9, “Purge Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rebuilding-tables.html" title="3.14 Rebuilding or Repairing Tables or Indexes">
Section 3.14, “Rebuilding or Repairing Tables or Indexes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reloading-delimited-text-dumps.html" title="9.4.4 Reloading Delimited-Text Format Backups">
Section 9.4.4, “Reloading Delimited-Text Format Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reloading-sql-format-dumps.html" title="9.4.2 Reloading SQL-Format Backups">
Section 9.4.2, “Reloading SQL-Format Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-partitioning.html" title="19.4.6 Replicating Different Databases to Different Replicas">
Section 19.4.6, “Replicating Different Databases to Different Replicas”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-transaction-inconsistencies.html" title="19.5.1.34 Replication and Transaction Inconsistencies">
Section 19.5.1.34, “Replication and Transaction Inconsistencies”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-restrictions.html" title="29.20 Restrictions on Performance Schema">
Section 29.20, “Restrictions on Performance Schema”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="view-restrictions.html" title="27.9 Restrictions on Views">
Section 27.9, “Restrictions on Views”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-destinations.html" title="7.4.1 Selecting General Query Log and Slow Query Log Output Destinations">
Section 7.4.1, “Selecting General Query Log and Slow Query Log Output Destinations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="set-sql-log-bin.html" title="15.4.1.3 SET sql_log_bin Statement">
Section 15.4.1.3, “SET sql_log_bin Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-setup-replicas.html#replication-howto-existingdata" title="19.1.2.6.2 Setting Up Replication with Existing Data">
Section 19.1.2.6.2, “Setting Up Replication with Existing Data”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="no-matching-rows.html" title="B.3.4.7 Solving Problems with No Matching Rows">
Section B.3.4.7, “Solving Problems with No Matching Rows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-functions.html" title="19.1.3.8 Stored Function Examples to Manipulate GTIDs">
Section 19.1.3.8, “Stored Function Examples to Manipulate GTIDs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
Section 13.3.4, “The BLOB and TEXT Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="features.html" title="1.2.2 The Main Features of MySQL">
Section 1.2.2, “The Main Features of MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
Section 15.7.4.6, “UNINSTALL PLUGIN Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="upgrade-binary-package.html" title="3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux">
Section 3.7, “Upgrading MySQL Binary or Package-based Installations on Unix/Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-gtids-failover.html" title="19.1.3.5 Using GTIDs for Failover and Scaleout">
Section 19.1.3.5, “Using GTIDs for Failover and Scaleout”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog-backup.html" title="6.6.9.3 Using mysqlbinlog to Back Up Binary Log Files">
Section 6.6.9.3, “Using mysqlbinlog to Back Up Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-mysqldump.html" title="9.4 Using mysqldump for Backups">
Section 9.4, “Using mysqldump for Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups.html" title="19.4.1 Using Replication for Backups">
Section 19.4.1, “Using Replication for Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-diffengines.html" title="19.4.4 Using Replication with Different Source and Replica Storage Engines">
Section 19.4.4, “Using Replication with Different Source and Replica Storage Engines”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-usage.html" title="7.6.4.2 Using the Rewriter Query Rewrite Plugin">
Section 7.6.4.2, “Using the Rewriter Query Rewrite Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sys-schema-usage.html" title="30.2 Using the sys Schema">
Section 30.2, “Using the sys Schema”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="xml-functions.html" title="14.11 XML Functions">
Section 14.11, “XML Functions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqldump mysql
</h3>
<dl>
<dt>
<a class="xref" href="problems-connecting.html" title="8.2.22 Troubleshooting Problems Connecting to MySQL">
Section 8.2.22, “Troubleshooting Problems Connecting to MySQL”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqldumpslow
</h3>
<dl>
<dt>
<a class="xref" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
Section 6.6.10, “mysqldumpslow — Summarize Slow Query Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlimport
</h3>
<dl>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="copying-databases.html" title="3.15 Copying MySQL Databases to Another Machine">
Section 3.15, “Copying MySQL Databases to Another Machine”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-methods.html" title="9.2 Database Backup Methods">
Section 9.2, “Database Backup Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
Section 6.5.5, “mysqlimport — A Data Import Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reloading-delimited-text-dumps.html" title="9.4.4 Reloading Delimited-Text Format Backups">
Section 9.4.4, “Reloading Delimited-Text Format Backups”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="load-data-local-security.html" title="8.1.6 Security Considerations for LOAD DATA LOCAL">
Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqloptimize
</h3>
<dl>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlpump
</h3>
<dl>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlrepair
</h3>
<dl>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlsh
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-shell-tutorial-javascript-shell.html" title="22.3.1 MySQL Shell">
Section 22.3.1, “MySQL Shell”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-shell-tutorial-python-shell.html" title="22.4.1 MySQL Shell">
Section 22.4.1, “MySQL Shell”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlshow
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
Section 6.5.6, “mysqlshow — Display Database, Table, and Column Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
Section 15.7.7.15, “SHOW DATABASES Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
Section 15.7.7.23, “SHOW INDEX Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
Section 15.7.7.38, “SHOW TABLE STATUS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-testing.html" title="2.3.3.9 Testing The MySQL Installation">
Section 2.3.3.9, “Testing The MySQL Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
Section 2.9.3, “Testing the Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-postinstallation.html" title="2.3.5 Windows Postinstallation Procedures">
Section 2.3.5, “Windows Postinstallation Procedures”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlshow db_name
</h3>
<dl>
<dt>
<a class="xref" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
Section 15.7.7.39, “SHOW TABLES Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlshow db_name tbl_name
</h3>
<dl>
<dt>
<a class="xref" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
Section 15.7.7.6, “SHOW COLUMNS Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlslap
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="cleartext-pluggable-authentication.html" title="8.4.1.4 Client-Side Cleartext Pluggable Authentication">
Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="monitor-innodb-mutex-waits-performance-schema.html" title="17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema">
Section 17.16.2, “Monitoring InnoDB Mutex Waits Using Performance Schema”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
Section 6.5.7, “mysqlslap — A Load Emulation Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="custom-benchmarks.html" title="10.13.2 Using Your Own Benchmarks">
Section 10.13.2, “Using Your Own Benchmarks”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqltest
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="session-state-tracking.html" title="7.1.18 Server Tracking of Client Session State">
Section 7.1.18, “Server Tracking of Client Session State”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mysqlxtest
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-N">
</a>
<h3 class="title">
N
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
nbdmtd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_blob_tool
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
Section 25.5.6, “ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster
Tables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_config
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-config.html" title="25.5.7 ndb_config — Extract NDB Cluster Configuration Information">
Section 25.5.7, “ndb_config — Extract NDB Cluster Configuration Information”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_delete_all
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-delete-all.html" title="25.5.8 ndb_delete_all — Delete All Rows from an NDB Table">
Section 25.5.8, “ndb_delete_all — Delete All Rows from an NDB Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_desc
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="partitioning-key.html" title="26.2.5 KEY Partitioning">
Section 26.2.5, “KEY Partitioning”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-mysql-security-procedures.html" title="25.6.21.3 NDB Cluster and MySQL Security Procedures">
Section 25.6.21.3, “NDB Cluster and MySQL Security Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-disk-data-objects.html" title="25.6.11.1 NDB Cluster Disk Data Objects">
Section 25.6.11.1, “NDB Cluster Disk Data Objects”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
Section 25.5.9, “ndb_desc — Describe NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="create-table-ndb-comment-options.html" title="15.1.20.12 Setting NDB Comment Options">
Section 15.1.20.12, “Setting NDB Comment Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
Section 28.3.15, “The INFORMATION_SCHEMA FILES Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
Section 28.3.21, “The INFORMATION_SCHEMA PARTITIONS Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-cluster-operations.html" title="25.6.17.8 The ndbinfo cluster_operations Table">
Section 25.6.17.8, “The ndbinfo cluster_operations Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-server-operations.html" title="25.6.17.55 The ndbinfo server_operations Table">
Section 25.6.17.55, “The ndbinfo server_operations Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_drop_index
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-drop-index.html" title="25.5.10 ndb_drop_index — Drop Index from an NDB Table">
Section 25.5.10, “ndb_drop_index — Drop Index from an NDB Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_drop_table
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-drop-index.html" title="25.5.10 ndb_drop_index — Drop Index from an NDB Table">
Section 25.5.10, “ndb_drop_index — Drop Index from an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-drop-table.html" title="25.5.11 ndb_drop_table — Drop an NDB Table">
Section 25.5.11, “ndb_drop_table — Drop an NDB Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_error_reporter
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-error-reporter.html" title="25.5.12 ndb_error_reporter — NDB Error-Reporting Utility">
Section 25.5.12, “ndb_error_reporter — NDB Error-Reporting Utility”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_import
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-importing-data.html" title="25.6.9 Importing Data Into MySQL Cluster">
Section 25.6.9, “Importing Data Into MySQL Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_index_stat
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-index-stat.html" title="25.5.14 ndb_index_stat — NDB Index Statistics Utility">
Section 25.5.14, “ndb_index_stat — NDB Index Statistics Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-index-stats.html" title="25.6.17.41 The ndbinfo index_stats Table">
Section 25.6.17.41, “The ndbinfo index_stats Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_mgm
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-remarks.html" title="25.6.7.1 Adding NDB Cluster Data Nodes Online: General Issues">
Section 25.6.7.1, “Adding NDB Cluster Data Nodes Online: General Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-event-reports.html" title="25.6.3 Event Reports Generated in NDB Cluster">
Section 25.6.3, “Event Reports Generated in NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-general-info.html" title="25.1 General Information">
Section 25.1, “General Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux.html" title="25.3.1 Installation of NDB Cluster on Linux">
Section 25.3.1, “Installation of NDB Cluster on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-debian.html" title="25.3.1.3 Installing NDB Cluster Using .deb Files">
Section 25.3.1.3, “Installing NDB Cluster Using .deb Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-overview-requirements.html" title="25.2.3 NDB Cluster Hardware, Software, and Networking Requirements">
Section 25.2.3, “NDB Cluster Hardware, Software, and Networking Requirements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-logging-management-commands.html" title="25.6.3.1 NDB Cluster Logging Management Commands">
Section 25.6.3.1, “NDB Cluster Logging Management Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-networking-issues.html" title="25.6.21.1 NDB Cluster Security and Networking Issues">
Section 25.6.21.1, “NDB Cluster Security and Networking Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-single-user-mode.html" title="25.6.6 NDB Cluster Single User Mode">
Section 25.6.6, “NDB Cluster Single User Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
Section 25.5.5, “ndb_mgm — The NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
Section 25.5.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-sign-keys.html" title="25.5.28 ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB Cluster">
Section 25.5.28, “ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB
Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup.html" title="25.6.8 Online Backup of NDB Cluster">
Section 25.6.8, “Online Backup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-arbitrator-validity-detail.html" title="25.6.17.1 The ndbinfo arbitrator_validity_detail Table">
Section 25.6.17.1, “The ndbinfo arbitrator_validity_detail Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-backup-id.html" title="25.6.17.3 The ndbinfo backup_id Table">
Section 25.6.17.3, “The ndbinfo backup_id Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-membership.html" title="25.6.17.45 The ndbinfo membership Table">
Section 25.6.17.45, “The ndbinfo membership Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-memoryusage.html" title="25.6.17.46 The ndbinfo memoryusage Table">
Section 25.6.17.46, “The ndbinfo memoryusage Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
Section 25.6.17.48, “The ndbinfo nodes Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-transporters.html" title="25.6.17.66 The ndbinfo transporters Table">
Section 25.6.17.66, “The ndbinfo transporters Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-what-is-new.html" title="25.2.4 What is New in MySQL NDB Cluster 8.4">
Section 25.2.4, “What is New in MySQL NDB Cluster 8.4”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_mgm.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_mgmd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-definition.html" title="25.4.3.5 Defining an NDB Cluster Management Server">
Section 25.4.3.5, “Defining an NDB Cluster Management Server”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux.html" title="25.3.1 Installation of NDB Cluster on Linux">
Section 25.3.1, “Installation of NDB Cluster on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-debian.html" title="25.3.1.3 Installing NDB Cluster Using .deb Files">
Section 25.3.1.3, “Installing NDB Cluster Using .deb Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-config-example.html" title="25.4.3.1 NDB Cluster Configuration: Basic Example">
Section 25.4.3.1, “NDB Cluster Configuration: Basic Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-connection-strings.html" title="25.4.3.3 NDB Cluster Connection Strings">
Section 25.4.3.3, “NDB Cluster Connection Strings”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-logging-management-commands.html" title="25.6.3.1 NDB Cluster Logging Management Commands">
Section 25.6.3.1, “NDB Cluster Logging Management Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tcp-definition.html" title="25.4.3.10 NDB Cluster TCP/IP Connections">
Section 25.4.3.10, “NDB Cluster TCP/IP Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
Section 25.5.6, “ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster
Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-delete-all.html" title="25.5.8 ndb_delete_all — Delete All Rows from an NDB Table">
Section 25.5.8, “ndb_delete_all — Delete All Rows from an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
Section 25.5.9, “ndb_desc — Describe NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-drop-index.html" title="25.5.10 ndb_drop_index — Drop Index from an NDB Table">
Section 25.5.10, “ndb_drop_index — Drop Index from an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-drop-table.html" title="25.5.11 ndb_drop_table — Drop an NDB Table">
Section 25.5.11, “ndb_drop_table — Drop an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-import.html" title="25.5.13 ndb_import — Import CSV Data Into NDB">
Section 25.5.13, “ndb_import — Import CSV Data Into NDB”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-index-stat.html" title="25.5.14 ndb_index_stat — NDB Index Statistics Utility">
Section 25.5.14, “ndb_index_stat — NDB Index Statistics Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
Section 25.5.5, “ndb_mgm — The NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
Section 25.5.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-move-data.html" title="25.5.15 ndb_move_data — NDB Data Copy Utility">
Section 25.5.15, “ndb_move_data — NDB Data Copy Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
Section 25.5.25, “ndb_select_all — Print Rows from an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-select-count.html" title="25.5.26 ndb_select_count — Print Row Counts for NDB Tables">
Section 25.5.26, “ndb_select_count — Print Row Counts for NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
Section 25.5.27, “ndb_show_tables — Display List of NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-sign-keys.html" title="25.5.28 ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB Cluster">
Section 25.5.28, “ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB
Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-waiter.html" title="25.5.31 ndb_waiter — Wait for NDB Cluster to Reach a Given Status">
Section 25.5.31, “ndb_waiter — Wait for NDB Cluster to Reach a Given Status”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbinfo-select-all.html" title="25.5.2 ndbinfo_select_all — Select From ndbinfo Tables">
Section 25.5.2, “ndbinfo_select_all — Select From ndbinfo Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-quick.html" title="25.4.1 Quick Test Setup of NDB Cluster">
Section 25.4.1, “Quick Test Setup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-start-phases.html" title="25.6.4 Summary of NDB Cluster Start Phases">
Section 25.6.4, “Summary of NDB Cluster Start Phases”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_mgmd.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_move_data
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-move-data.html" title="25.5.15 ndb_move_data — NDB Data Copy Utility">
Section 25.5.15, “ndb_move_data — NDB Data Copy Utility”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_perror
</h3>
<dl>
<dt>
<a class="xref" href="error-interfaces.html" title="B.2 Error Information Interfaces">
Section B.2, “Error Information Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
Section 25.5.16, “ndb_perror — Obtain NDB Error Message Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
Section 6.8.1, “perror — Display MySQL Error Message Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-error-messages.html" title="25.6.17.34 The ndbinfo error_messages Table">
Section 25.6.17.34, “The ndbinfo error_messages Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_backup
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbxfrm.html" title="25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB Cluster">
Section 25.5.32, “ndbxfrm — Compress, Decompress, Encrypt, and Decrypt
Files Created by NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_backup_file
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-backup-file.html" title="25.5.17 ndb_print_backup_file — Print NDB Backup File Contents">
Section 25.5.17, “ndb_print_backup_file — Print NDB Backup File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-frag-file.html" title="25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents">
Section 25.5.19, “ndb_print_frag_file — Print NDB Fragment List File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-schema-file.html" title="25.5.20 ndb_print_schema_file — Print NDB Schema File Contents">
Section 25.5.20, “ndb_print_schema_file — Print NDB Schema File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-sys-file.html" title="25.5.21 ndb_print_sys_file — Print NDB System File Contents">
Section 25.5.21, “ndb_print_sys_file — Print NDB System File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-redo-log-reader.html" title="25.5.22 ndb_redo_log_reader — Check and Print Content of Cluster Redo Log">
Section 25.5.22, “ndb_redo_log_reader — Check and Print Content of Cluster Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_file
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-file.html" title="25.5.18 ndb_print_file — Print NDB Disk Data File Contents">
Section 25.5.18, “ndb_print_file — Print NDB Disk Data File Contents”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_frag_file
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-frag-file.html" title="25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents">
Section 25.5.19, “ndb_print_frag_file — Print NDB Fragment List File Contents”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_schema_file
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-backup-file.html" title="25.5.17 ndb_print_backup_file — Print NDB Backup File Contents">
Section 25.5.17, “ndb_print_backup_file — Print NDB Backup File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-file.html" title="25.5.18 ndb_print_file — Print NDB Disk Data File Contents">
Section 25.5.18, “ndb_print_file — Print NDB Disk Data File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-frag-file.html" title="25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents">
Section 25.5.19, “ndb_print_frag_file — Print NDB Fragment List File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-schema-file.html" title="25.5.20 ndb_print_schema_file — Print NDB Schema File Contents">
Section 25.5.20, “ndb_print_schema_file — Print NDB Schema File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-sys-file.html" title="25.5.21 ndb_print_sys_file — Print NDB System File Contents">
Section 25.5.21, “ndb_print_sys_file — Print NDB System File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-redo-log-reader.html" title="25.5.22 ndb_redo_log_reader — Check and Print Content of Cluster Redo Log">
Section 25.5.22, “ndb_redo_log_reader — Check and Print Content of Cluster Redo Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_print_sys_file
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-backup-file.html" title="25.5.17 ndb_print_backup_file — Print NDB Backup File Contents">
Section 25.5.17, “ndb_print_backup_file — Print NDB Backup File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-file.html" title="25.5.18 ndb_print_file — Print NDB Disk Data File Contents">
Section 25.5.18, “ndb_print_file — Print NDB Disk Data File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-frag-file.html" title="25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents">
Section 25.5.19, “ndb_print_frag_file — Print NDB Fragment List File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-schema-file.html" title="25.5.20 ndb_print_schema_file — Print NDB Schema File Contents">
Section 25.5.20, “ndb_print_schema_file — Print NDB Schema File Contents”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-print-sys-file.html" title="25.5.21 ndb_print_sys_file — Print NDB System File Contents">
Section 25.5.21, “ndb_print_sys_file — Print NDB System File Contents”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_redo_log_reader
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-redo-log-reader.html" title="25.5.22 ndb_redo_log_reader — Check and Print Content of Cluster Redo Log">
Section 25.5.22, “ndb_redo_log_reader — Check and Print Content of Cluster Redo Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_restore
</h3>
<dl>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-importing-data.html" title="25.6.9 Importing Data Into MySQL Cluster">
Section 25.6.9, “Importing Data Into MySQL Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-backups.html" title="25.7.9 NDB Cluster Backups With NDB Cluster Replication">
Section 25.7.9, “NDB Cluster Backups With NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-overview.html" title="25.2 NDB Cluster Overview">
Section 25.2, “NDB Cluster Overview”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-schema.html" title="25.7.4 NDB Cluster Replication Schema and Tables">
Section 25.7.4, “NDB Cluster Replication Schema and Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-multi-source.html" title="25.7.10 NDB Cluster Replication: Bidirectional and Circular Replication">
Section 25.7.10, “NDB Cluster Replication: Bidirectional and Circular Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-single-user-mode.html" title="25.6.6 NDB Cluster Single User Mode">
Section 25.6.6, “NDB Cluster Single User Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbxfrm.html" title="25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB Cluster">
Section 25.5.32, “ndbxfrm — Compress, Decompress, Encrypt, and Decrypt
Files Created by NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup.html" title="25.6.8 Online Backup of NDB Cluster">
Section 25.6.8, “Online Backup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_secretsfile_reader
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-tde-implementation.html" title="25.6.14.2 NDB File System Encryption Implementation">
Section 25.6.14.2, “NDB File System Encryption Implementation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-secretsfile-reader.html" title="25.5.24 ndb_secretsfile_reader — Obtain Key Information from an Encrypted NDB Data File">
Section 25.5.24, “ndb_secretsfile_reader — Obtain Key Information from an Encrypted NDB
Data File”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_select_all
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-security-mysql-security-procedures.html" title="25.6.21.3 NDB Cluster and MySQL Security Procedures">
Section 25.6.21.3, “NDB Cluster and MySQL Security Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
Section 25.5.25, “ndb_select_all — Print Rows from an NDB Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
Section 25.5.27, “ndb_show_tables — Display List of NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-privilege-synchronization.html" title="25.6.13 Privilege Synchronization and NDB_STORED_USER">
Section 25.6.13, “Privilege Synchronization and NDB_STORED_USER”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_select_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-select-count.html" title="25.5.26 ndb_select_count — Print Row Counts for NDB Tables">
Section 25.5.26, “ndb_select_count — Print Row Counts for NDB Tables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_show_tables
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-security-mysql-security-procedures.html" title="25.6.21.3 NDB Cluster and MySQL Security Procedures">
Section 25.6.21.3, “NDB Cluster and MySQL Security Procedures”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
Section 25.5.27, “ndb_show_tables — Display List of NDB Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-cluster-locks.html" title="25.6.17.7 The ndbinfo cluster_locks Table">
Section 25.6.17.7, “The ndbinfo cluster_locks Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-cluster-operations.html" title="25.6.17.8 The ndbinfo cluster_operations Table">
Section 25.6.17.8, “The ndbinfo cluster_operations Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-locks-per-fragment.html" title="25.6.17.42 The ndbinfo locks_per_fragment Table">
Section 25.6.17.42, “The ndbinfo locks_per_fragment Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-operations-per-fragment.html" title="25.6.17.49 The ndbinfo operations_per_fragment Table">
Section 25.6.17.49, “The ndbinfo operations_per_fragment Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-server-locks.html" title="25.6.17.54 The ndbinfo server_locks Table">
Section 25.6.17.54, “The ndbinfo server_locks Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-server-operations.html" title="25.6.17.55 The ndbinfo server_operations Table">
Section 25.6.17.55, “The ndbinfo server_operations Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_sign_keys
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-tls-keys.html" title="25.6.15.2 Creating a CA and Keys">
Section 25.6.15.2, “Creating a CA and Keys”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-sign-keys.html" title="25.5.28 ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB Cluster">
Section 25.5.28, “ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB
Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-what-is-new.html" title="25.2.4 What is New in MySQL NDB Cluster 8.4">
Section 25.2.4, “What is New in MySQL NDB Cluster 8.4”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_size.pl
</h3>
<dl>
<dt>
<a class="xref" href="storage-requirements.html" title="13.7 Data Type Storage Requirements">
Section 13.7, “Data Type Storage Requirements”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-size-pl.html" title="25.5.29 ndb_size.pl — NDBCLUSTER Size Requirement Estimator">
Section 25.5.29, “ndb_size.pl — NDBCLUSTER Size Requirement Estimator”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_top
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-top.html" title="25.5.30 ndb_top — View CPU usage information for NDB threads">
Section 25.5.30, “ndb_top — View CPU usage information for NDB threads”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndb_waiter
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-waiter.html" title="25.5.31 ndb_waiter — Wait for NDB Cluster to Reach a Given Status">
Section 25.5.31, “ndb_waiter — Wait for NDB Cluster to Reach a Given Status”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-basics.html" title="25.6.7.2 Adding NDB Cluster Data Nodes Online: Basic procedure">
Section 25.6.7.2, “Adding NDB Cluster Data Nodes Online: Basic procedure”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux.html" title="25.3.1 Installation of NDB Cluster on Linux">
Section 25.3.1, “Installation of NDB Cluster on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-debian.html" title="25.3.1.3 Installing NDB Cluster Using .deb Files">
Section 25.3.1.3, “Installing NDB Cluster Using .deb Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-management.html" title="25.6 Management of NDB Cluster">
Section 25.6, “Management of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-backups.html" title="25.7.9 NDB Cluster Backups With NDB Cluster Replication">
Section 25.7.9, “NDB Cluster Backups With NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-config-example.html" title="25.4.3.1 NDB Cluster Configuration: Basic Example">
Section 25.4.3.1, “NDB Cluster Configuration: Basic Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-params-ndbd.html" title="25.4.2.1 NDB Cluster Data Node Configuration Parameters">
Section 25.4.2.1, “NDB Cluster Data Node Configuration Parameters”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-installation.html" title="25.3 NDB Cluster Installation">
Section 25.3, “NDB Cluster Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
Section 25.5.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-waiter.html" title="25.5.31 ndb_waiter — Wait for NDB Cluster to Reach a Given Status">
Section 25.5.31, “ndb_waiter — Wait for NDB Cluster to Reach a Given Status”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
Section 25.5.3, “ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-configuration-overview.html" title="25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables">
Section 25.4.2, “Overview of NDB Cluster Configuration Parameters, Options, and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-quick.html" title="25.4.1 Quick Test Setup of NDB Cluster">
Section 25.4.1, “Quick Test Setup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-config-starting.html" title="25.4.3.2 Recommended Starting Configuration for NDB Cluster">
Section 25.4.3.2, “Recommended Starting Configuration for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-start-phases.html" title="25.6.4 Summary of NDB Cluster Start Phases">
Section 25.6.4, “Summary of NDB Cluster Start Phases”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
Section 25.6.17.48, “The ndbinfo nodes Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-log-statistics.html" title="25.6.3.3 Using CLUSTERLOG STATISTICS in the NDB Cluster Management Client">
Section 25.6.3.3, “Using CLUSTERLOG STATISTICS in the NDB Cluster Management Client”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbd.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbinfo_select_all
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbinfo-select-all.html" title="25.5.2 ndbinfo_select_all — Select From ndbinfo Tables">
Section 25.5.2, “ndbinfo_select_all — Select From ndbinfo Tables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbmtd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-basics.html" title="25.6.7.2 Adding NDB Cluster Data Nodes Online: Basic procedure">
Section 25.6.7.2, “Adding NDB Cluster Data Nodes Online: Basic procedure”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux.html" title="25.3.1 Installation of NDB Cluster on Linux">
Section 25.3.1, “Installation of NDB Cluster on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-basics.html" title="25.2.1 NDB Cluster Core Concepts">
Section 25.2.1, “NDB Cluster Core Concepts”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-params-ndbd.html" title="25.4.2.1 NDB Cluster Data Node Configuration Parameters">
Section 25.4.2.1, “NDB Cluster Data Node Configuration Parameters”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs.html" title="25.5 NDB Cluster Programs">
Section 25.5, “NDB Cluster Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
Section 25.5.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-top.html" title="25.5.30 ndb_top — View CPU usage information for NDB threads">
Section 25.5.30, “ndb_top — View CPU usage information for NDB threads”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
Section 25.5.3, “ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-replication-pitr.html" title="25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication">
Section 25.7.9.2, “Point-In-Time Recovery Using NDB Cluster Replication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-config-starting.html" title="25.4.3.2 Recommended Starting Configuration for NDB Cluster">
Section 25.4.3.2, “Recommended Starting Configuration for NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
Section 25.6.17.48, “The ndbinfo nodes Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-resources.html" title="25.6.17.52 The ndbinfo resources Table">
Section 25.6.17.52, “The ndbinfo resources Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbmtd.exe
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-initial-start.html" title="25.3.2.3 Initial Startup of NDB Cluster on Windows">
Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ndbxfrm
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-tde-implementation.html" title="25.6.14.2 NDB File System Encryption Implementation">
Section 25.6.14.2, “NDB File System Encryption Implementation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndbxfrm.html" title="25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB Cluster">
Section 25.5.32, “ndbxfrm — Compress, Decompress, Encrypt, and Decrypt
Files Created by NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET START
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET START mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-troubleshooting.html" title="2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation">
Section 2.3.4, “Troubleshooting a Microsoft Windows MySQL Server Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-upgrading.html" title="3.11 Upgrading MySQL on Windows">
Section 3.11, “Upgrading MySQL on Windows”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET STOP
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET STOP mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-upgrading.html" title="3.11 Upgrading MySQL on Windows">
Section 3.11, “Upgrading MySQL on Windows”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
NET STOP service_name
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
nsupdate
</h3>
<dl>
<dt>
<a class="xref" href="replication-solutions-switch.html" title="19.4.8 Switching Sources During Failover">
Section 19.4.8, “Switching Sources During Failover”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
numactl
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-O">
</a>
<h3 class="title">
O
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
okvutil
</h3>
<dl>
<dt>
<a class="xref" href="keyring-okv-plugin.html" title="8.4.4.6 Using the keyring_okv KMIP Plugin">
Section 8.4.4.6, “Using the keyring_okv KMIP Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
openssl
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-logging-configuration.html" title="8.4.5.5 Configuring Audit Logging Characteristics">
Section 8.4.5.5, “Configuring Audit Logging Characteristics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-rsa-files-using-openssl.html" title="8.3.3.3 Creating RSA Keys Using openssl">
Section 8.3.3.3, “Creating RSA Keys Using openssl”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-ssl-rsa-files.html" title="8.3.3 Creating SSL and RSA Certificates and Keys">
Section 8.3.3, “Creating SSL and RSA Certificates and Keys”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-ssl-rsa-files-using-mysql.html" title="8.3.3.1 Creating SSL and RSA Certificates and Keys using MySQL">
Section 8.3.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="creating-ssl-files-using-openssl.html" title="8.3.3.2 Creating SSL Certificates and Keys Using openssl">
Section 8.3.3.2, “Creating SSL Certificates and Keys Using openssl”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="nonpersistible-system-variables.html" title="7.1.9.4 Nonpersistible and Persist-Restricted System Variables">
Section 7.1.9.4, “Nonpersistible and Persist-Restricted System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keyring-okv-plugin.html" title="8.4.4.6 Using the keyring_okv KMIP Plugin">
Section 8.4.4.6, “Using the keyring_okv KMIP Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
openssl md5 package_name
</h3>
<dl>
<dt>
<a class="xref" href="verifying-md5-checksum.html" title="2.1.4.1 Verifying the MD5 Checksum">
Section 2.1.4.1, “Verifying the MD5 Checksum”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-P">
</a>
<h3 class="title">
P
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
patchelf
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
perf
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
Section 29.12.22.8, “The threads Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
perror
</h3>
<dl>
<dt>
<a class="xref" href="cannot-create.html" title="B.3.2.11 Can't create/write to file">
Section B.3.2.11, “Can't create/write to file”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-interfaces.html" title="B.2 Error Information Interfaces">
Section B.2, “Error Information Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="myisam-repair.html" title="9.6.3 How to Repair MyISAM Tables">
Section 9.6.3, “How to Repair MyISAM Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
Section 25.5.16, “ndb_perror — Obtain NDB Error Message Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="programs-overview.html" title="6.1 Overview of MySQL Programs">
Section 6.1, “Overview of MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
Section 6.8.1, “perror — Display MySQL Error Message Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="error-log-rule-based-filtering.html" title="7.4.2.6 Rule-Based Error Log Filtering (log_filter_dragnet)">
Section 7.4.2.6, “Rule-Based Error Log Filtering (log_filter_dragnet)”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
pfexec
</h3>
<dl>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
PGP
</h3>
<dl>
<dt>
<a class="xref" href="checking-gpg-signature.html" title="2.1.4.2 Signature Checking Using GnuPG">
Section 2.1.4.2, “Signature Checking Using GnuPG”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ping6
</h3>
<dl>
<dt>
<a class="xref" href="ipv6-brokers.html" title="7.1.13.5 Obtaining an IPv6 Address from a Broker">
Section 7.1.13.5, “Obtaining an IPv6 Address from a Broker”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
pkg-config
</h3>
<dl>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
Section 6.7.1, “mysql_config — Display Options for Compiling Clients”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
pkgadd
</h3>
<dl>
<dt>
<a class="xref" href="solaris-installation-pkg.html" title="2.7.1 Installing MySQL on Solaris Using a Solaris PKG">
Section 2.7.1, “Installing MySQL on Solaris Using a Solaris PKG”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
pkgrm
</h3>
<dl>
<dt>
<a class="xref" href="solaris-installation-pkg.html" title="2.7.1 Installing MySQL on Solaris Using a Solaris PKG">
Section 2.7.1, “Installing MySQL on Solaris Using a Solaris PKG”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ppm
</h3>
<dl>
<dt>
<a class="xref" href="perl-support.html" title="2.10 Perl Installation Notes">
Section 2.10, “Perl Installation Notes”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ps
</h3>
<dl>
<dt>
<a class="xref" href="assigning-passwords.html" title="8.2.14 Assigning Account Passwords">
Section 8.2.14, “Assigning Account Passwords”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux.html" title="8.7 SELinux">
Section 8.7, “SELinux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
Section 29.12.2.3, “The setup_instruments Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
Section 29.12.22.8, “The threads Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="starting-server-troubleshooting.html" title="2.9.2.1 Troubleshooting Problems Starting the MySQL Server">
Section 2.9.2.1, “Troubleshooting Problems Starting the MySQL Server”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ps xa | grep mysqld
</h3>
<dl>
<dt>
<a class="xref" href="can-not-connect-to-server.html" title="B.3.2.2 Can't connect to [local] MySQL server">
Section B.3.2.2, “Can't connect to [local] MySQL server”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-R">
</a>
<h3 class="title">
R
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
rename
</h3>
<dl>
<dt>
<a class="xref" href="error-log-rotation.html" title="7.4.2.10 Error Log File Flushing and Renaming">
Section 7.4.2.10, “Error Log File Flushing and Renaming”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
restart
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
rm
</h3>
<dl>
<dt>
<a class="xref" href="purge-binary-logs.html" title="15.4.1.1 PURGE BINARY LOGS Statement">
Section 15.4.1.1, “PURGE BINARY LOGS Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
rpm
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="checking-rpm-signature.html" title="2.1.4.4 Signature Checking Using RPM">
Section 2.1.4.4, “Signature Checking Using RPM”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
rpmbuild
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
rsync
</h3>
<dl>
<dt>
<a class="xref" href="replication-howto-additionalslaves.html" title="19.1.2.8 Adding Replicas to a Replication Environment">
Section 19.1.2.8, “Adding Replicas to a Replication Environment”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-S">
</a>
<h3 class="title">
S
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC DELETE
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC DELETE mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC DELETE service_name
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC START
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC START mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-troubleshooting.html" title="2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation">
Section 2.3.4, “Troubleshooting a Microsoft Windows MySQL Server Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-upgrading.html" title="3.11 Upgrading MySQL on Windows">
Section 3.11, “Upgrading MySQL on Windows”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sc start mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC STOP
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="multiple-windows-services.html" title="7.8.2.2 Starting Multiple MySQL Instances as Windows Services">
Section 7.8.2.2, “Starting Multiple MySQL Instances as Windows Services”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC STOP mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sc stop mysqld_service_name
</h3>
<dl>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SC STOP service_name
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-shutdown-restart.html" title="25.3.6 Safe Shutdown and Restart of NDB Cluster">
Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
scp
</h3>
<dl>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sed
</h3>
<dl>
<dt>
<a class="xref" href="pattern-matching.html" title="5.3.4.7 Pattern Matching">
Section 5.3.4.7, “Pattern Matching”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SELECT
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-example-data.html" title="25.3.5 NDB Cluster Example with Tables and Data">
Section 25.3.5, “NDB Cluster Example with Tables and Data”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
semanage
</h3>
<dl>
<dt>
<a class="xref" href="selinux-troubleshooting.html" title="8.7.6 Troubleshooting SELinux">
Section 8.7.6, “Troubleshooting SELinux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
semodule
</h3>
<dl>
<dt>
<a class="xref" href="selinux-policies.html" title="8.7.3 MySQL Server SELinux Policies">
Section 8.7.3, “MySQL Server SELinux Policies”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
service
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Service Control Manager
</h3>
<dl>
<dt>
<a class="xref" href="windows-installation.html" title="2.3 Installing MySQL on Microsoft Windows">
Section 2.3, “Installing MySQL on Microsoft Windows”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Services
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sestatus
</h3>
<dl>
<dt>
<a class="xref" href="selinux-mode.html" title="8.7.2 Changing the SELinux Mode">
Section 8.7.2, “Changing the SELinux Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux-checking.html" title="8.7.1 Check if SELinux is Enabled">
Section 8.7.1, “Check if SELinux is Enabled”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="group-replication-frequently-asked-questions.html" title="20.10 Frequently Asked Questions">
Section 20.10, “Frequently Asked Questions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
setcap
</h3>
<dl>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resource-groups.html" title="7.1.16 Resource Groups">
Section 7.1.16, “Resource Groups”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
setenforce
</h3>
<dl>
<dt>
<a class="xref" href="selinux-mode.html" title="8.7.2 Changing the SELinux Mode">
Section 8.7.2, “Changing the SELinux Mode”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="selinux-troubleshooting.html" title="8.7.6 Troubleshooting SELinux">
Section 8.7.6, “Troubleshooting SELinux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
setenv
</h3>
<dl>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sh
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SHOW
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-quick.html" title="25.4.1 Quick Test Setup of NDB Cluster">
Section 25.4.1, “Quick Test Setup of NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SHOW ERRORS
</h3>
<dl>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
SHOW WARNINGS
</h3>
<dl>
<dt>
<a class="xref" href="faqs-mysql-cluster.html" title="A.10 MySQL 8.4 FAQ: NDB Cluster">
Section A.10, “MySQL 8.4 FAQ: NDB Cluster”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sleep
</h3>
<dl>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ssh
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-tls-keys.html" title="25.6.15.2 Creating a CA and Keys">
Section 25.6.15.2, “Creating a CA and Keys”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-security-networking-issues.html" title="25.6.21.1 NDB Cluster Security and Networking Issues">
Section 25.6.21.1, “NDB Cluster Security and Networking Issues”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-tls-using.html" title="25.6.15.3 Using TLS Connections">
Section 25.6.15.3, “Using TLS Connections”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ssl_session_data_print
</h3>
<dl>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
start
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Start>Run>cmd.exe
</h3>
<dl>
<dt>
<a class="xref" href="creating-ssl-files-using-openssl.html" title="8.3.3.2 Creating SSL Certificates and Keys Using openssl">
Section 8.3.3.2, “Creating SSL Certificates and Keys Using openssl”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
status
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
stop
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
strings
</h3>
<dl>
<dt>
<a class="xref" href="security-guidelines.html" title="8.1.1 Security Guidelines">
Section 8.1.1, “Security Guidelines”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
su
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
su root
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sudo
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="resource-groups.html" title="7.1.16 Resource Groups">
Section 7.1.16, “Resource Groups”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sudo ip
</h3>
<dl>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sudo setcap
</h3>
<dl>
<dt>
<a class="xref" href="network-namespace-support.html" title="7.1.14 Network Namespace Support">
Section 7.1.14, “Network Namespace Support”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
sysctl
</h3>
<dl>
<dt>
<a class="xref" href="large-page-support.html" title="10.12.3.3 Enabling Large Page Support">
Section 10.12.3.3, “Enabling Large Page Support”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
systemctl
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-native.html" title="2.5.7 Installing MySQL on Linux from the Native Software Repositories">
Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
systemd
</h3>
<dl>
<dt>
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-T">
</a>
<h3 class="title">
T
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
tar
</h3>
<dl>
<dt>
<a class="xref" href="replication-howto-additionalslaves.html" title="19.1.2.8 Adding Replicas to a Replication Environment">
Section 19.1.2.8, “Adding Replicas to a Replication Environment”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-solutions-backups-rawdata.html" title="19.4.1.2 Backing Up Raw Data from a Replica">
Section 19.4.1.2, “Backing Up Raw Data from a Replica”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="backup-types.html" title="9.1 Backup and Recovery Types">
Section 9.1, “Backup and Recovery Types”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="database-use.html" title="5.3 Creating and Using a Database">
Section 5.3, “Creating and Using a Database”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation.html" title="2.4 Installing MySQL on macOS">
Section 2.4, “Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation-pkg.html" title="2.7.1 Installing MySQL on Solaris Using a Solaris PKG">
Section 2.7.1, “Installing MySQL on Solaris Using a Solaris PKG”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="perl-installation.html" title="2.10.1 Installing Perl on Unix">
Section 2.10.1, “Installing Perl on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-methods.html" title="2.8.1 Source Installation Methods">
Section 2.8.1, “Source Installation Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="symbolic-links-to-databases.html" title="10.12.2.1 Using Symbolic Links for Databases on Unix">
Section 10.12.2.1, “Using Symbolic Links for Databases on Unix”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keyring-okv-plugin.html" title="8.4.4.6 Using the keyring_okv KMIP Plugin">
Section 8.4.4.6, “Using the keyring_okv KMIP Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="which-version.html" title="2.1.2 Which MySQL Version and Distribution to Install">
Section 2.1.2, “Which MySQL Version and Distribution to Install”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
tcpdump
</h3>
<dl>
<dt>
<a class="xref" href="security-guidelines.html" title="8.1.1 Security Guidelines">
Section 8.1.1, “Security Guidelines”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
tcsh
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="macos-installation-notes.html" title="2.4.1 General Notes on Installing MySQL on macOS">
Section 2.4.1, “General Notes on Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
tee
</h3>
<dl>
<dt>
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
telnet
</h3>
<dl>
<dt>
<a class="xref" href="security-guidelines.html" title="8.1.1 Security Guidelines">
Section 8.1.1, “Security Guidelines”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Terminal
</h3>
<dl>
<dt>
<a class="xref" href="macos-installation.html" title="2.4 Installing MySQL on macOS">
Section 2.4, “Installing MySQL on macOS”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Text in this style
</h3>
<dl>
<dt>
<a class="xref" href="manual-info.html" title="1.1 About This Manual">
Section 1.1, “About This Manual”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
top
</h3>
<dl>
<dt>
<a class="xref" href="what-is-crashing.html" title="B.3.1 How to Determine What Is Causing a Problem">
Section B.3.1, “How to Determine What Is Causing a Problem”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-ndbinfo-processes.html" title="25.6.17.51 The ndbinfo processes Table">
Section 25.6.17.51, “The ndbinfo processes Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-U">
</a>
<h3 class="title">
U
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
u
</h3>
<dl>
<dt>
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
ulimit
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="packet-too-large.html" title="B.3.2.8 Packet Too Large">
Section B.3.2.8, “Packet Too Large”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
unix_chkpwd
</h3>
<dl>
<dt>
<a class="xref" href="pam-pluggable-authentication.html" title="8.4.1.5 PAM Pluggable Authentication">
Section 8.4.1.5, “PAM Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
update-rc.d
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
useradd
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-linux-binary.html" title="25.3.1.1 Installing an NDB Cluster Binary Release on Linux">
Section 25.3.1.1, “Installing an NDB Cluster Binary Release on Linux”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="solaris-installation.html" title="2.7 Installing MySQL on Solaris">
Section 2.7, “Installing MySQL on Solaris”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
util.checkForServerUpgrade()
</h3>
<dl>
<dt>
<a class="xref" href="upgrade-best-practices.html" title="3.3 Upgrade Best Practices">
Section 3.3, “Upgrade Best Practices”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-V">
</a>
<h3 class="title">
V
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
vault
</h3>
<dl>
<dt>
<a class="xref" href="keyring-hashicorp-plugin.html" title="8.4.4.8 Using the HashiCorp Vault Keyring Plugin">
Section 8.4.4.8, “Using the HashiCorp Vault Keyring Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
vault server
</h3>
<dl>
<dt>
<a class="xref" href="keyring-hashicorp-plugin.html" title="8.4.4.8 Using the HashiCorp Vault Keyring Plugin">
Section 8.4.4.8, “Using the HashiCorp Vault Keyring Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
vi
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="pattern-matching.html" title="5.3.4.7 Pattern Matching">
Section 5.3.4.7, “Pattern Matching”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-W">
</a>
<h3 class="title">
W
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
watch
</h3>
<dl>
<dt>
<a class="xref" href="sys-statement-performance-analyzer.html" title="30.4.4.25 The statement_performance_analyzer() Procedure">
Section 30.4.4.25, “The statement_performance_analyzer() Procedure”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
WinDbg
</h3>
<dl>
<dt>
<a class="xref" href="making-windows-dumps.html" title="7.9.1.3 Using WER with PDB to create a Windows crashdump">
Section 7.9.1.3, “Using WER with PDB to create a Windows crashdump”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
windbg.exe
</h3>
<dl>
<dt>
<a class="xref" href="making-windows-dumps.html" title="7.9.1.3 Using WER with PDB to create a Windows crashdump">
Section 7.9.1.3, “Using WER with PDB to create a Windows crashdump”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
winMd5Sum
</h3>
<dl>
<dt>
<a class="xref" href="verifying-md5-checksum.html" title="2.1.4.1 Verifying the MD5 Checksum">
Section 2.1.4.1, “Verifying the MD5 Checksum”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
WinZip
</h3>
<dl>
<dt>
<a class="xref" href="replication-solutions-backups-rawdata.html" title="19.4.1.2 Backing Up Raw Data from a Replica">
Section 19.4.1.2, “Backing Up Raw Data from a Replica”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="source-installation-prerequisites.html" title="2.8.2 Source Installation Prerequisites">
Section 2.8.2, “Source Installation Prerequisites”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
WordPad
</h3>
<dl>
<dt>
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-X">
</a>
<h3 class="title">
X
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
xz
</h3>
<dl>
<dt>
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-Y">
</a>
<h3 class="title">
Y
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yacc
</h3>
<dl>
<dt>
<a class="xref" href="compilation-problems.html" title="2.8.8 Dealing with Problems Compiling MySQL">
Section 2.8.8, “Dealing with Problems Compiling MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="keywords.html" title="11.3 Keywords and Reserved Words">
Section 11.3, “Keywords and Reserved Words”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yum
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-native.html" title="2.5.7 Installing MySQL on Linux from the Native Software Repositories">
Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-install-linux-rpm.html" title="25.3.1.2 Installing NDB Cluster from RPM">
Section 25.3.1.2, “Installing NDB Cluster from RPM”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="updating-yum-repo.html" title="3.8 Upgrading MySQL with the MySQL Yum Repository">
Section 3.8, “Upgrading MySQL with the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yum install
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yum update
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yum update mysql-server
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
yum-config-manager
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="command-index-Z">
</a>
<h3 class="title">
Z
</h3>
<p>
[
<a class="link" href="dynindex-command.html#command-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
zip
</h3>
<dl>
<dt>
<a class="xref" href="replication-snapshot-method.html#replication-howto-rawdata" title="19.1.2.5.2 Creating a Data Snapshot Using Raw Data Files">
Section 19.1.2.5.2, “Creating a Data Snapshot Using Raw Data Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
zlib_decompress
</h3>
<dl>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
zsh
</h3>
<dl>
<dt>
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
zypper
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
zypper install
</h3>
<dl>
<dt>
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-replication.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-replication">
</a>
7.6.7.7 Cloning for Replication
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255402416">
</a>
<p>
The clone plugin supports replication. In addition to cloning
data, a cloning operation extracts replication coordinates from
the donor and transfers them to the recipient, which enables
using the clone plugin for provisioning Group Replication
members and replicas. Using the clone plugin for provisioning is
considerably faster and more efficient than replicating a large
number of transactions.
</p>
<p>
Group Replication members can also be configured to use the
clone plugin as an option for distributed recovery, in which
case joining members automatically choose the most efficient way
to retrieve group data from existing group members. For more
information, see
<a class="xref" href="group-replication-cloning.html" title="20.5.4.2 Cloning for Distributed Recovery">
Section 20.5.4.2, “Cloning for Distributed Recovery”
</a>
.
</p>
<p>
During the cloning operation, both the binary log position
(filename, offset) and the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
GTID set are
extracted and transferred from the donor MySQL server instance
to the recipient. This data permits initiating replication at a
consistent position in the replication stream. The binary logs
and relay logs, which are held in files, are not copied from the
donor to the recipient. To initiate replication, the binary logs
required for the recipient to catch up to the donor must not be
purged between the time that the data is cloned and the time
that replication is started. If the required binary logs are not
available, a replication handshake error is reported. A cloned
instance should therefore be added to a replication group
without excessive delay to avoid required binary logs being
purged or the new member lagging behind significantly, requiring
more recovery time.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Issue this query on a cloned MySQL server instance to check
the binary log position that was transferred to the
recipient:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa70593575"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> BINLOG_FILE<span class="token punctuation">,</span> BINLOG_POSITION <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>clone_status<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Issue this query on a cloned MySQL server instance to check
the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
GTID set
that was transferred to the recipient:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa74185098"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@GLOBAL.GTID_EXECUTED</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
By default, the replication metadata repositories are held in
tables that are copied from the donor to the recipient during
the cloning operation. The replication metadata repositories
hold replication-related configuration settings that can be used
to resume replication correctly after the cloning operation. The
tables
<code class="literal">
mysql.slave_master_info
</code>
,
<code class="literal">
mysql.slave_relay_log_info
</code>
, and
<code class="literal">
mysql.slave_worker_info
</code>
are all copied.
</p>
<p>
For a list of what is included in each table, see
<a class="xref" href="replica-logs-status.html" title="19.2.4.2 Replication Metadata Repositories">
Section 19.2.4.2, “Replication Metadata Repositories”
</a>
.
</p>
<p>
To clone for replication, perform the following steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
For a new group member for Group Replication, first
configure the MySQL Server instance for Group Replication,
following the instructions in
<a class="xref" href="group-replication-adding-instances.html" title="20.2.1.6 Adding Instances to the Group">
Section 20.2.1.6, “Adding Instances to the Group”
</a>
. Also
set up the prerequisites for cloning described in
<a class="xref" href="group-replication-cloning.html" title="20.5.4.2 Cloning for Distributed Recovery">
Section 20.5.4.2, “Cloning for Distributed Recovery”
</a>
. When you issue
<a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
<code class="literal">
START GROUP_REPLICATION
</code>
</a>
on
the joining member, the cloning operation is managed
automatically by Group Replication, so you do not need to
carry out the operation manually, and you do not need to
perform any further setup steps on the joining member.
</p>
</li>
<li class="listitem">
<p>
For a replica in a source/replica MySQL replication
topology, first clone the data from the donor MySQL server
instance to the recipient manually. The donor must be a
source or replica in the replication topology. For cloning
instructions, see
<a class="xref" href="clone-plugin-remote.html" title="7.6.7.3 Cloning Remote Data">
Section 7.6.7.3, “Cloning Remote Data”
</a>
.
</p>
</li>
<li class="listitem">
<p>
After the cloning operation completes successfully, if you
want to use the same replication channels on the recipient
MySQL server instance that were present on the donor, verify
which of them can resume replication automatically in the
source/replica MySQL replication topology, and which need to
be set up manually.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For GTID-based replication, if the recipient is
configured with
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
and has
cloned from a donor with
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
,
<code class="literal">
ON_PERMISSIVE
</code>
, or
<code class="literal">
OFF_PERMISSIVE
</code>
, the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
GTID set
from the donor is applied on the recipient. If the
recipient is cloned from a replica already in the
topology, replication channels on the recipient that use
GTID auto-positioning can resume replication
automatically after the cloning operation when the
channel is started. You do not need to perform any
manual setup if you just want to use these same
channels.
</p>
</li>
<li class="listitem">
<p>
For binary log file position based replication, the
binary log position from the donor is applied on the
recipient. Replication channels on the recipient that
use binary log file position based replication
automatically attempt to carry out the relay log
recovery process, using the cloned relay log
information, before restarting replication. For a
single-threaded replica
(
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
is set to 0), relay log recovery should succeed in the
absence of any other issues, enabling the channel to
resume replication with no further setup. For a
multithreaded replica
(
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
is greater than 0), relay log recovery is likely to fail
because it cannot usually be completed automatically. In
this case, an error message is issued, and you must set
the channel up manually.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
If you need to set up cloned replication channels manually,
or want to use different replication channels on the
recipient, the following instructions provide a summary and
abbreviated examples for adding a recipient MySQL server
instance to a replication topology. Also refer to the
detailed instructions that apply to your replication setup.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To add a recipient MySQL server instance to a MySQL
replication topology that uses GTID-based transactions
as the replication data source, configure the instance
as required, following the instructions in
<a class="xref" href="replication-gtids-howto.html" title="19.1.3.4 Setting Up Replication Using GTIDs">
Section 19.1.3.4, “Setting Up Replication Using GTIDs”
</a>
. Add
replication channels for the instance as shown in the
following abbreviated example. The
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE
TO
</code>
</a>
statement must define the host address and
port number of the source, and the
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option should be
enabled, as shown:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59175142"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_HOST</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">source_host_name</em>'</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_PORT</span> <span class="token operator">=</span> <em class="replaceable">source_port_num</em><span class="token punctuation">,</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">SOURCE_AUTO_POSITION</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'<em class="replaceable">setup_channel</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">START</span> <span class="token keyword">REPLICA</span> <span class="token keyword">USER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>'</span> <span class="token keyword">PASSWORD</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">password</em>'</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'<em class="replaceable">setup_channel</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To add a recipient MySQL server instance to a MySQL
replication topology that uses binary log file position
based replication, configure the instance as required,
following the instructions in
<a class="xref" href="replication-howto.html" title="19.1.2 Setting Up Binary Log File Position Based Replication">
Section 19.1.2, “Setting Up Binary Log File Position Based Replication”
</a>
. Add replication
channels for the instance as shown in the following
abbreviated example, using the binary log position that
was transferred to the recipient during the cloning
operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3444900"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> BINLOG_FILE<span class="token punctuation">,</span> BINLOG_POSITION <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>clone_status<span class="token punctuation">;</span>
<span class="token keyword">CHANGE</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_HOST</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">source_host_name</em>'</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_PORT</span> <span class="token operator">=</span> <em class="replaceable">source_port_num</em><span class="token punctuation">,</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">SOURCE_LOG_FILE</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">source_log_name</em>'</span><span class="token punctuation">,</span>
<span class="token keyword">SOURCE_LOG_POS</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">source_log_pos</em></span><span class="token punctuation">,</span>
<span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'<em class="replaceable">setup_channel</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">START</span> <span class="token keyword">REPLICA</span> <span class="token keyword">USER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>'</span> <span class="token keyword">PASSWORD</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">password</em>'</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'<em class="replaceable">setup_channel</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/lock-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="lock-tables">
</a>
15.3.6 LOCK TABLES and UNLOCK TABLES Statements
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045178557104">
</a>
<a class="indexterm" name="idm46045178556064">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99586613"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">LOCK</span> {<span class="token keyword">TABLE</span> <span class="token operator">|</span> <span class="token keyword">TABLES</span>}
<em class="replaceable">tbl_name</em> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">AS</span><span class="token punctuation">]</span> <em class="replaceable">alias</em><span class="token punctuation">]</span> <em class="replaceable">lock_type</em>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">tbl_name</em> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">AS</span><span class="token punctuation">]</span> <em class="replaceable">alias</em><span class="token punctuation">]</span> <em class="replaceable">lock_type</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<em class="replaceable">lock_type</em>: {
<span class="token keyword">READ</span> <span class="token punctuation">[</span><span class="token keyword">LOCAL</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">WRITE</span>
}
<span class="token keyword">UNLOCK</span> {<span class="token keyword">TABLE</span> <span class="token operator">|</span> <span class="token keyword">TABLES</span>}</code></pre>
</div>
<p>
MySQL enables client sessions to acquire table locks explicitly
for the purpose of cooperating with other sessions for access to
tables, or to prevent other sessions from modifying tables during
periods when a session requires exclusive access to them. A
session can acquire or release locks only for itself. One session
cannot acquire locks for another session or release locks held by
another session.
</p>
<p>
Locks may be used to emulate transactions or to get more speed
when updating tables. This is explained in more detail in
<a class="xref" href="lock-tables.html#lock-tables-restrictions" title="Table-Locking Restrictions and Conditions">
Table-Locking Restrictions and Conditions
</a>
.
</p>
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
explicitly acquires
table locks for the current client session. Table locks can be
acquired for base tables or views. You must have the
<a class="link" href="privileges-provided.html#priv_lock-tables">
<code class="literal">
LOCK TABLES
</code>
</a>
privilege, and the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for each object to
be locked.
</p>
<p>
For view locking,
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
adds
all base tables used in the view to the set of tables to be locked
and locks them automatically. For tables underlying any view being
locked,
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
checks that the
view definer (for
<code class="literal">
SQL SECURITY DEFINER
</code>
views)
or invoker (for all views) has the proper privileges on the
tables.
</p>
<p>
If you lock a table explicitly with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, any tables used in triggers are also locked
implicitly, as described in
<a class="xref" href="lock-tables.html#lock-tables-and-triggers" title="LOCK TABLES and Triggers">
LOCK TABLES and Triggers
</a>
.
</p>
<p>
If you lock a table explicitly with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, any tables related by a foreign key constraint
are opened and locked implicitly. For foreign key checks, a shared
read-only lock (
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES READ
</code>
</a>
) is taken on related tables. For cascading
updates, a shared-nothing write lock
(
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
WRITE
</code>
</a>
) is taken on related tables that are involved in
the operation.
</p>
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
explicitly releases any table locks held by the
current session.
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
implicitly releases any table locks held by the current session
before acquiring new locks.
</p>
<p>
Another use for
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
is to release the global read lock acquired with
the
<a class="link" href="flush.html#flush-tables-with-read-lock">
<code class="literal">
FLUSH TABLES WITH READ LOCK
</code>
</a>
statement, which enables you to lock all tables in all databases.
See
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
. (This is a very convenient way to get
backups if you have a file system such as Veritas that can take
snapshots in time.)
</p>
<p>
<code class="literal">
LOCK TABLE
</code>
is a synonym for
<code class="literal">
LOCK
TABLES
</code>
;
<code class="literal">
UNLOCK TABLE
</code>
is a synonym for
<code class="literal">
UNLOCK TABLES
</code>
.
</p>
<p>
A table lock protects only against inappropriate reads or writes
by other sessions. A session holding a
<code class="literal">
WRITE
</code>
lock can perform table-level operations such as
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
or
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
. For sessions
holding a
<code class="literal">
READ
</code>
lock,
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP
TABLE
</code>
</a>
and
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
operations are not permitted.
</p>
<p>
The following discussion applies only to
non-
<code class="literal">
TEMPORARY
</code>
tables.
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
is permitted (but ignored) for a
<code class="literal">
TEMPORARY
</code>
table. The table can be accessed
freely by the session within which it was created, regardless of
what other locking may be in effect. No lock is necessary because
no other session can see the table.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="lock-tables.html#table-lock-acquisition" title="Table Lock Acquisition">
Table Lock Acquisition
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="lock-tables.html#table-lock-release" title="Table Lock Release">
Table Lock Release
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="lock-tables.html#lock-tables-and-transactions" title="Interaction of Table Locking and Transactions">
Interaction of Table Locking and Transactions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="lock-tables.html#lock-tables-and-triggers" title="LOCK TABLES and Triggers">
LOCK TABLES and Triggers
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="lock-tables.html#lock-tables-restrictions" title="Table-Locking Restrictions and Conditions">
Table-Locking Restrictions and Conditions
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="table-lock-acquisition">
</a>
Table Lock Acquisition
</h4>
</div>
</div>
</div>
<p>
To acquire table locks within the current session, use the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement, which
acquires metadata locks (see
<a class="xref" href="metadata-locking.html" title="10.11.4 Metadata Locking">
Section 10.11.4, “Metadata Locking”
</a>
).
</p>
<p>
The following lock types are available:
</p>
<p>
<code class="literal">
READ [LOCAL]
</code>
lock:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The session that holds the lock can read the table (but not
write it).
</p>
</li>
<li class="listitem">
<p>
Multiple sessions can acquire a
<code class="literal">
READ
</code>
lock
for the table at the same time.
</p>
</li>
<li class="listitem">
<p>
Other sessions can read the table without explicitly
acquiring a
<code class="literal">
READ
</code>
lock.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
LOCAL
</code>
modifier enables nonconflicting
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements (concurrent
inserts) by other sessions to execute while the lock is
held. (See
<a class="xref" href="concurrent-inserts.html" title="10.11.3 Concurrent Inserts">
Section 10.11.3, “Concurrent Inserts”
</a>
.) However,
<code class="literal">
READ LOCAL
</code>
cannot be used if you are
going to manipulate the database using processes external to
the server while you hold the lock. For
<code class="literal">
InnoDB
</code>
tables,
<code class="literal">
READ
LOCAL
</code>
is the same as
<code class="literal">
READ
</code>
.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
WRITE
</code>
lock:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The session that holds the lock can read and write the
table.
</p>
</li>
<li class="listitem">
<p>
Only the session that holds the lock can access the table.
No other session can access it until the lock is released.
</p>
</li>
<li class="listitem">
<p>
Lock requests for the table by other sessions block while
the
<code class="literal">
WRITE
</code>
lock is held.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
WRITE
</code>
locks normally have higher priority
than
<code class="literal">
READ
</code>
locks to ensure that updates are
processed as soon as possible. This means that if one session
obtains a
<code class="literal">
READ
</code>
lock and then another session
requests a
<code class="literal">
WRITE
</code>
lock, subsequent
<code class="literal">
READ
</code>
lock requests wait until the session
that requested the
<code class="literal">
WRITE
</code>
lock has obtained
the lock and released it. (An exception to this policy can occur
for small values of the
<a class="link" href="server-system-variables.html#sysvar_max_write_lock_count">
<code class="literal">
max_write_lock_count
</code>
</a>
system
variable; see
<a class="xref" href="metadata-locking.html" title="10.11.4 Metadata Locking">
Section 10.11.4, “Metadata Locking”
</a>
.)
</p>
<p>
If the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement must
wait due to locks held by other sessions on any of the tables,
it blocks until all locks can be acquired.
</p>
<p>
A session that requires locks must acquire all the locks that it
needs in a single
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement. While the locks thus obtained are held, the session
can access only the locked tables. For example, in the following
sequence of statements, an error occurs for the attempt to
access
<code class="literal">
t2
</code>
because it was not locked in the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72771105"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">LOCK</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">READ</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> COUNT(*) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">;</span>
<span class="token output">ERROR 1100 (HY000)<span class="token punctuation">:</span> Table 't2' was not locked with LOCK TABLES</span></code></pre>
</div>
<p>
Tables in the
<code class="literal">
INFORMATION_SCHEMA
</code>
database are
an exception. They can be accessed without being locked
explicitly even while a session holds table locks obtained with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
.
</p>
<p>
You cannot refer to a locked table multiple times in a single
query using the same name. Use aliases instead, and obtain a
separate lock for the table and each alias:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68738162"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">LOCK</span> <span class="token keyword">TABLE</span> t <span class="token keyword">WRITE</span><span class="token punctuation">,</span> t <span class="token keyword">AS</span> t1 <span class="token keyword">READ</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">ERROR 1100<span class="token punctuation">:</span> Table 't' was not locked with LOCK TABLES</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">AS</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
The error occurs for the first
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
because there are two
references to the same name for a locked table. The second
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
succeeds because the
references to the table use different names.
</p>
<p>
If your statements refer to a table by means of an alias, you
must lock the table using that same alias. It does not work to
lock the table without specifying the alias:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49911195"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">LOCK</span> <span class="token keyword">TABLE</span> t <span class="token keyword">READ</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">AS</span> myalias<span class="token punctuation">;</span>
<span class="token output">ERROR 1100<span class="token punctuation">:</span> Table 'myalias' was not locked with LOCK TABLES</span></code></pre>
</div>
<p>
Conversely, if you lock a table using an alias, you must refer
to it in your statements using that alias:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36196620"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">LOCK</span> <span class="token keyword">TABLE</span> t <span class="token keyword">AS</span> myalias <span class="token keyword">READ</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">ERROR 1100<span class="token punctuation">:</span> Table 't' was not locked with LOCK TABLES</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">AS</span> myalias<span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="table-lock-release">
</a>
Table Lock Release
</h4>
</div>
</div>
</div>
<p>
When the table locks held by a session are released, they are
all released at the same time. A session can release its locks
explicitly, or locks may be released implicitly under certain
conditions.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A session can release its locks explicitly with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
If a session issues a
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
statement to acquire a lock while already
holding locks, its existing locks are released implicitly
before the new locks are granted.
</p>
</li>
<li class="listitem">
<p>
If a session begins a transaction (for example, with
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
START
TRANSACTION
</code>
</a>
), an implicit
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
is performed, which causes existing locks
to be released. (For additional information about the
interaction between table locking and transactions, see
<a class="xref" href="lock-tables.html#lock-tables-and-transactions" title="Interaction of Table Locking and Transactions">
Interaction of Table Locking and Transactions
</a>
.)
</p>
</li>
</ul>
</div>
<p>
If the connection for a client session terminates, whether
normally or abnormally, the server implicitly releases all table
locks held by the session (transactional and nontransactional).
If the client reconnects, the locks are no longer in effect. In
addition, if the client had an active transaction, the server
rolls back the transaction upon disconnect, and if reconnect
occurs, the new session begins with autocommit enabled. For this
reason, clients may wish to disable auto-reconnect. With
auto-reconnect in effect, the client is not notified if
reconnect occurs but any table locks or current transaction are
lost. With auto-reconnect disabled, if the connection drops, an
error occurs for the next statement issued. The client can
detect the error and take appropriate action such as reacquiring
the locks or redoing the transaction. See
<a class="ulink" href="/doc/c-api/8.4/en/c-api-auto-reconnect.html" target="_top">
Automatic Reconnection Control
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you use
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
on a
locked table, it may become unlocked. For example, if you
attempt a second
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation, the result may be an error
<code class="literal">
Table
'
<em class="replaceable">
<code>
tbl_name
</code>
</em>
' was not locked with LOCK
TABLES
</code>
. To handle this, lock the table again prior
to the second alteration. See also
<a class="xref" href="alter-table-problems.html" title="B.3.6.1 Problems with ALTER TABLE">
Section B.3.6.1, “Problems with ALTER TABLE”
</a>
.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="lock-tables-and-transactions">
</a>
Interaction of Table Locking and Transactions
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045178431872">
</a>
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
and
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
interact with the use of transactions as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
is not
transaction-safe and implicitly commits any active
transaction before attempting to lock the tables.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
implicitly commits any active transaction,
but only if
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
has
been used to acquire table locks. For example, in the
following set of statements,
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
releases the global read lock but does not
commit the transaction because no table locks are in effect:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85727477"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> <span class="token keyword">WITH</span> <span class="token keyword">READ</span> <span class="token keyword">LOCK</span><span class="token punctuation">;</span>
<span class="token keyword">START</span> <span class="token keyword">TRANSACTION</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">;</span>
<span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Beginning a transaction (for example, with
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
START
TRANSACTION
</code>
</a>
) implicitly commits any current
transaction and releases existing table locks.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="flush.html#flush-tables-with-read-lock">
<code class="literal">
FLUSH TABLES WITH READ LOCK
</code>
</a>
acquires a global read lock and not table locks, so it is
not subject to the same behavior as
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
and
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
with respect to table locking and implicit
commits. For example,
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
START
TRANSACTION
</code>
</a>
does not release the global read lock.
See
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Other statements that implicitly cause transactions to be
committed do not release existing table locks. For a list of
such statements, see
<a class="xref" href="implicit-commit.html" title="15.3.3 Statements That Cause an Implicit Commit">
Section 15.3.3, “Statements That Cause an Implicit Commit”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The correct way to use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
and
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
with transactional tables, such as
<code class="literal">
InnoDB
</code>
tables, is to begin a transaction
with
<code class="literal">
SET autocommit = 0
</code>
(not
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
START
TRANSACTION
</code>
</a>
) followed by
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, and to not call
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
until you commit the transaction
explicitly. For example, if you need to write to table
<code class="literal">
t1
</code>
and read from table
<code class="literal">
t2
</code>
, you can do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40321075"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> autocommit<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">LOCK</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">WRITE</span><span class="token punctuation">,</span> t2 <span class="token keyword">READ</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">;</span>
<span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">do</span> something <span class="token keyword">with</span> <span class="token keyword">tables</span> t1 <span class="token operator">and</span> t2 here <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></em><span class="token punctuation"></span>
<span class="token keyword">COMMIT</span><span class="token punctuation">;</span>
<span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When you call
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
,
<code class="literal">
InnoDB
</code>
internally takes its own table
lock, and MySQL takes its own table lock.
<code class="literal">
InnoDB
</code>
releases its internal table lock
at the next commit, but for MySQL to release its table lock,
you have to call
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
. You should not have
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit = 1
</code>
</a>
, because
then
<code class="literal">
InnoDB
</code>
releases its internal table
lock immediately after the call of
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, and deadlocks can very easily happen.
<code class="literal">
InnoDB
</code>
does not acquire the internal
table lock at all if
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit =
1
</code>
</a>
, to help old applications avoid unnecessary
deadlocks.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
does not release table locks.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="lock-tables-and-triggers">
</a>
LOCK TABLES and Triggers
</h4>
</div>
</div>
</div>
<p>
If you lock a table explicitly with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, any tables used in triggers are also locked
implicitly:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The locks are taken as the same time as those acquired
explicitly with the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
The lock on a table used in a trigger depends on whether the
table is used only for reading. If so, a read lock suffices.
Otherwise, a write lock is used.
</p>
</li>
<li class="listitem">
<p>
If a table is locked explicitly for reading with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
, but needs to be
locked for writing because it might be modified within a
trigger, a write lock is taken rather than a read lock.
(That is, an implicit write lock needed due to the table's
appearance within a trigger causes an explicit read lock
request for the table to be converted to a write lock
request.)
</p>
</li>
</ul>
</div>
<p>
Suppose that you lock two tables,
<code class="literal">
t1
</code>
and
<code class="literal">
t2
</code>
, using this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97930542"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">LOCK</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">WRITE</span><span class="token punctuation">,</span> t2 <span class="token keyword">READ</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If
<code class="literal">
t1
</code>
or
<code class="literal">
t2
</code>
have any
triggers, tables used within the triggers are also locked.
Suppose that
<code class="literal">
t1
</code>
has a trigger defined like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69407311"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TRIGGER</span> t1_a_ins <span class="token keyword">AFTER</span> <span class="token keyword">INSERT</span> <span class="token keyword">ON</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EACH</span> <span class="token keyword">ROW</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">UPDATE</span> t4 <span class="token keyword">SET</span> count <span class="token operator">=</span> count<span class="token operator">+</span><span class="token number">1</span>
<span class="token keyword">WHERE</span> id <span class="token operator">=</span> <span class="token keyword">NEW</span><span class="token punctuation">.</span>id <span class="token operator">AND</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> a <span class="token keyword">FROM</span> t3<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The result of the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement is that
<code class="literal">
t1
</code>
and
<code class="literal">
t2
</code>
are locked because they appear in the
statement, and
<code class="literal">
t3
</code>
and
<code class="literal">
t4
</code>
are locked because they are used within the trigger:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
t1
</code>
is locked for writing per the
<code class="literal">
WRITE
</code>
lock request.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
t2
</code>
is locked for writing, even though the
request is for a
<code class="literal">
READ
</code>
lock. This occurs
because
<code class="literal">
t2
</code>
is inserted into within the
trigger, so the
<code class="literal">
READ
</code>
request is converted
to a
<code class="literal">
WRITE
</code>
request.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
t3
</code>
is locked for reading because it is
only read from within the trigger.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
t4
</code>
is locked for writing because it might
be updated within the trigger.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="lock-tables-restrictions">
</a>
Table-Locking Restrictions and Conditions
</h4>
</div>
</div>
</div>
<p>
You can safely use
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
to
terminate a session that is waiting for a table lock. See
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
.
</p>
<p>
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
and
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
cannot be used within stored programs.
</p>
<p>
Tables in the
<code class="literal">
performance_schema
</code>
database
cannot be locked with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, except the
<code class="literal">
setup_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables.
</p>
<p>
The scope of a lock generated by
<code class="literal">
LOCK TABLES
</code>
is a single MySQL server. It is not compatible with NDB Cluster,
which has no way of enforcing an SQL-level lock across multiple
instances of
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. You can enforce locking
in an API application instead. See
<a class="xref" href="mysql-cluster-limitations-multiple-nodes.html" title="25.2.7.10 Limitations Relating to Multiple NDB Cluster Nodes">
Section 25.2.7.10, “Limitations Relating to Multiple NDB Cluster Nodes”
</a>
, for
more information.
</p>
<p>
The following statements are prohibited while a
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement is in
effect:
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
,
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
LIKE
</code>
</a>
,
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
,
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
, and DDL statements on
stored functions and procedures and events.
</p>
<p>
For some operations, system tables in the
<code class="literal">
mysql
</code>
database must be accessed. For example,
the
<a class="link" href="help.html" title="15.8.3 HELP Statement">
<code class="literal">
HELP
</code>
</a>
statement requires the
contents of the server-side help tables, and
<a class="link" href="date-and-time-functions.html#function_convert-tz">
<code class="literal">
CONVERT_TZ()
</code>
</a>
might need to read
the time zone tables. 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:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa79129655"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql.help_category
mysql.help_keyword
mysql.help_relation
mysql.help_topic
mysql.time_zone
mysql.time_zone_leap_second
mysql.time_zone_name
mysql.time_zone_transition
mysql.time_zone_transition_type</code></pre>
</div>
<p>
If you want to explicitly place a
<code class="literal">
WRITE
</code>
lock
on any of those tables with a
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
statement, the table must be the only one
locked; no other table can be locked with the same statement.
</p>
<p>
Normally, you do not need to lock tables, because all single
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements are atomic; no
other session can interfere with any other currently executing
SQL statement. However, there are a few cases when locking
tables may provide an advantage:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you are going to run many operations on a set of
<code class="literal">
MyISAM
</code>
tables, it is much faster to lock
the tables you are going to use. Locking
<code class="literal">
MyISAM
</code>
tables speeds up inserting,
updating, or deleting on them because MySQL does not flush
the key cache for the locked tables until
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
is called. Normally, the key cache is
flushed after each SQL statement.
</p>
<p>
The downside to locking the tables is that no session can
update a
<code class="literal">
READ
</code>
-locked table (including the
one holding the lock) and no session can access a
<code class="literal">
WRITE
</code>
-locked table other than the one
holding the lock.
</p>
</li>
<li class="listitem">
<p>
If you are using tables for a nontransactional storage
engine, you must use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
if you want to ensure that no other session
modifies the tables between a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
and an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
. The example shown
here requires
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
to
execute safely:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66524421"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">LOCK</span> <span class="token keyword">TABLES</span> trans <span class="token keyword">READ</span><span class="token punctuation">,</span> customer <span class="token keyword">WRITE</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">SUM</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> trans <span class="token keyword">WHERE</span> customer_id<span class="token operator">=</span><em class="replaceable">some_id</em><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> customer
<span class="token keyword">SET</span> total_value<span class="token operator">=</span><em class="replaceable">sum_from_previous_statement</em>
<span class="token keyword">WHERE</span> customer_id<span class="token operator">=</span><em class="replaceable">some_id</em><span class="token punctuation">;</span>
<span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Without
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
, it is
possible that another session might insert a new row in the
<code class="literal">
trans
</code>
table between execution of the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
and
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements.
</p>
</li>
</ul>
</div>
<p>
You can avoid using
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
in many cases by using relative updates (
<code class="literal">
UPDATE
customer SET
<em class="replaceable">
<code>
value
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
+
<em class="replaceable">
<code>
new_value
</code>
</em>
</code>
)
or the
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
function.
</p>
<p>
You can also avoid locking tables in some cases by using the
user-level advisory lock functions
<a class="link" href="locking-functions.html#function_get-lock">
<code class="literal">
GET_LOCK()
</code>
</a>
and
<a class="link" href="locking-functions.html#function_release-lock">
<code class="literal">
RELEASE_LOCK()
</code>
</a>
. These locks are
saved in a hash table in the server and implemented with
<code class="literal">
pthread_mutex_lock()
</code>
and
<code class="literal">
pthread_mutex_unlock()
</code>
for high speed. See
<a class="xref" href="locking-functions.html" title="14.14 Locking Functions">
Section 14.14, “Locking Functions”
</a>
.
</p>
<p>
See
<a class="xref" href="internal-locking.html" title="10.11.1 Internal Locking Methods">
Section 10.11.1, “Internal Locking Methods”
</a>
, for more information on
locking policy.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-basics.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-basics">
</a>
25.2.1 NDB Cluster Core Concepts
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045124342032">
</a>
<a class="indexterm" name="idm46045124340576">
</a>
<a class="indexterm" name="idm46045124339088">
</a>
<a class="indexterm" name="idm46045124337600">
</a>
<a class="indexterm" name="idm46045124336096">
</a>
<a class="indexterm" name="idm46045124334608">
</a>
<a class="indexterm" name="idm46045124333120">
</a>
<a class="indexterm" name="idm46045124331216">
</a>
<a class="indexterm" name="idm46045124329296">
</a>
<a class="indexterm" name="idm46045124327376">
</a>
<a class="indexterm" name="idm46045124325472">
</a>
<a class="indexterm" name="idm46045124323984">
</a>
<a class="indexterm" name="idm46045124322496">
</a>
<a class="indexterm" name="idm46045124321008">
</a>
<a class="indexterm" name="idm46045124319520">
</a>
<p>
<span class="firstterm">
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
</span>
(also known as
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
) is an in-memory
storage engine offering high-availability and data-persistence
features.
</p>
<p>
The
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine can be
configured with a range of failover and load-balancing options,
but it is easiest to start with the storage engine at the cluster
level. NDB Cluster's
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage
engine contains a complete set of data, dependent only on other
data within the cluster itself.
</p>
<p>
The
<span class="quote">
“
<span class="quote">
Cluster
</span>
”
</span>
portion of NDB Cluster is configured
independently of the MySQL servers. In an NDB Cluster, each part
of the cluster is considered to be a
<span class="firstterm">
node
</span>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In many contexts, the term
<span class="quote">
“
<span class="quote">
node
</span>
”
</span>
is used to
indicate a computer, but when discussing NDB Cluster it means a
<span class="emphasis">
<em>
process
</em>
</span>
. It is possible to run multiple
nodes on a single computer; for a computer on which one or more
cluster nodes are being run we use the term
<span class="firstterm">
cluster host
</span>
.
</p>
</div>
<p>
There are three types of cluster nodes, and in a minimal NDB
Cluster configuration, there are at least three nodes, one of each
of these types:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="firstterm">
Management node
</span>
: The
role of this type of node is to manage the other nodes within
the NDB Cluster, performing such functions as providing
configuration data, starting and stopping nodes, and running
backups. Because this node type manages the configuration of
the other nodes, a node of this type should be started first,
before any other node. A management node is started with the
command
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="firstterm">
Data node
</span>
: This type of
node stores cluster data. There are as many data nodes as
there are fragment replicas, times the number of fragments
(see
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
). For
example, with two fragment replicas, each having two
fragments, you need four data nodes. One fragment replica is
sufficient for data storage, but provides no redundancy;
therefore, it is recommended to have two (or more) fragment
replicas to provide redundancy, and thus high availability. A
data node is started with the command
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd
</strong>
</span>
</a>
(see
<a class="xref" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”
</a>
) or
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
(see
<a class="xref" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
Section 25.5.3, “ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)”
</a>
).
</p>
<p>
NDB Cluster tables are normally stored completely in memory
rather than on disk (this is why we refer to NDB Cluster as an
<span class="firstterm">
in-memory
</span>
database).
However, some NDB Cluster data can be stored on disk; see
<a class="xref" href="mysql-cluster-disk-data.html" title="25.6.11 NDB Cluster Disk Data Tables">
Section 25.6.11, “NDB Cluster Disk Data Tables”
</a>
, for more
information.
</p>
</li>
<li class="listitem">
<p>
<span class="firstterm">
SQL node
</span>
: This is a node
that accesses the cluster data. In the case of NDB Cluster, an
SQL node is a traditional MySQL server that uses the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine. An SQL
node is a
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process started with the
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
<code class="option">
--ndbcluster
</code>
</a>
and
<code class="option">
--ndb-connectstring
</code>
options, which are
explained elsewhere in this chapter, possibly with additional
MySQL server options as well.
</p>
<p>
An SQL node is actually just a specialized type of
<span class="firstterm">
API node
</span>
, which
designates any application which accesses NDB Cluster data.
Another example of an API node is the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
utility that is used to restore
a cluster backup. It is possible to write such applications
using the NDB API. For basic information about the NDB API,
see
<a class="ulink" href="/doc/ndbapi/en/ndb-getting-started.html" target="_top">
Getting Started with the NDB API
</a>
.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
It is not realistic to expect to employ a three-node setup in a
production environment. Such a configuration provides no
redundancy; to benefit from NDB Cluster's high-availability
features, you must use multiple data and SQL nodes. The use of
multiple management nodes is also highly recommended.
</p>
</div>
<p>
For a brief introduction to the relationships between nodes, node
groups, fragment replicas, and partitions in NDB Cluster, see
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
.
</p>
<p>
Configuration of a cluster involves configuring each individual
node in the cluster and setting up individual communication links
between nodes. NDB Cluster is currently designed with the
intention that data nodes are homogeneous in terms of processor
power, memory space, and bandwidth. In addition, to provide a
single point of configuration, all configuration data for the
cluster as a whole is located in one configuration file.
</p>
<p>
The management server manages the cluster configuration file and
the cluster log. Each node in the cluster retrieves the
configuration data from the management server, and so requires a
way to determine where the management server resides. When
interesting events occur in the data nodes, the nodes transfer
information about these events to the management server, which
then writes the information to the cluster log.
</p>
<p>
In addition, there can be any number of cluster client processes
or applications. These include standard MySQL clients,
<code class="literal">
NDB
</code>
-specific API programs, and management
clients. These are described in the next few paragraphs.
</p>
<p>
<b>
Standard MySQL clients.
</b>
NDB Cluster can be used with existing MySQL applications written
in PHP, Perl, C, C++, Java, Python, and so on. Such client
applications send SQL statements to and receive responses from
MySQL servers acting as NDB Cluster SQL nodes in much the same
way that they interact with standalone MySQL servers.
</p>
<a class="indexterm" name="idm46045124278320">
</a>
<a class="indexterm" name="idm46045124276832">
</a>
<a class="indexterm" name="idm46045124275344">
</a>
<p>
MySQL clients using an NDB Cluster as a data source can be
modified to take advantage of the ability to connect with multiple
MySQL servers to achieve load balancing and failover. For example,
Java clients using Connector/J 5.0.6 and later can use
<code class="literal">
jdbc:mysql:loadbalance://
</code>
URLs (improved in
Connector/J 5.1.7) to achieve load balancing transparently; for
more information about using Connector/J with NDB Cluster, see
<a class="ulink" href="/doc/ndbapi/en/mccj-using-connectorj.html" target="_top">
Using Connector/J with NDB Cluster
</a>
.
</p>
<p>
<b>
NDB client programs.
</b>
Client programs can be written that access NDB Cluster data
directly from the
<code class="literal">
NDBCLUSTER
</code>
storage engine,
bypassing any MySQL Servers that may be connected to the
cluster, using the
<span class="firstterm">
NDB
API
</span>
, a high-level C++ API. Such applications may be
useful for specialized purposes where an SQL interface to the
data is not needed. For more information, see
<a class="ulink" href="/doc/ndbapi/en/ndbapi.html" target="_top">
The NDB API
</a>
.
</p>
<p>
<code class="literal">
NDB
</code>
-specific Java applications can also be
written for NDB Cluster using the
<span class="firstterm">
NDB
Cluster Connector for Java
</span>
. This NDB Cluster Connector
includes
<span class="firstterm">
ClusterJ
</span>
, a
high-level database API similar to object-relational mapping
persistence frameworks such as Hibernate and JPA that connect
directly to
<code class="literal">
NDBCLUSTER
</code>
, and so does not require
access to a MySQL Server. See
<a class="ulink" href="/doc/ndbapi/en/mccj-overview-java.html" target="_top">
Java and NDB Cluster
</a>
, and
<a class="ulink" href="/doc/ndbapi/en/mccj-overview-clusterj-object-models.html" target="_top">
The ClusterJ API and Data Object Model
</a>
, for more
information.
</p>
<p>
NDB Cluster also supports applications written in JavaScript using
Node.js. The MySQL Connector for JavaScript includes adapters for
direct access to the
<code class="literal">
NDB
</code>
storage engine and as
well as for the MySQL Server. Applications using this Connector
are typically event-driven and use a domain object model similar
in many ways to that employed by ClusterJ. For more information,
see
<a class="ulink" href="/doc/ndbapi/en/ndb-nodejs.html" target="_top">
MySQL NoSQL Connector for JavaScript
</a>
.
</p>
<p>
<b>
Management clients.
</b>
These clients connect to the management server and provide
commands for starting and stopping nodes gracefully, starting
and stopping message tracing (debug versions only), showing node
versions and status, starting and stopping backups, and so on.
An example of this type of program is the
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
management client supplied with NDB
Cluster (see
<a class="xref" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
Section 25.5.5, “ndb_mgm — The NDB Cluster Management Client”
</a>
).
Such applications can be written using the
<span class="firstterm">
MGM API
</span>
, a C-language API
that communicates directly with one or more NDB Cluster
management servers. For more information, see
<a class="ulink" href="/doc/ndbapi/en/mgm-api.html" target="_top">
The MGM API
</a>
.
</p>
<p>
Oracle also makes available MySQL Cluster Manager, which provides an advanced
command-line interface simplifying many complex NDB Cluster
management tasks, such restarting an NDB Cluster with a large
number of nodes. The MySQL Cluster Manager client also supports commands for
getting and setting the values of most node configuration
parameters as well as
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server options and
variables relating to NDB Cluster. See
<a class="ulink" href="/doc/mysql-cluster-manager/8.4/en/" target="_top">
MySQL Cluster Manager 8.4.3 User Manual
</a>
, for
more information.
</p>
<p>
<b>
Event logs.
</b>
NDB 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
<a class="xref" href="mysql-cluster-event-reports.html" title="25.6.3 Event Reports Generated in NDB Cluster">
Section 25.6.3, “Event Reports Generated in NDB Cluster”
</a>
. Event logs are of
the two types listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="firstterm">
Cluster log
</span>
: Keeps a
record of all desired reportable events for the cluster as a
whole.
</p>
</li>
<li class="listitem">
<p>
<span class="firstterm">
Node log
</span>
: A separate log
which is also kept for each individual node.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Under normal circumstances, it is necessary and sufficient to
keep and examine only the cluster log. The node logs need be
consulted only for application development and debugging
purposes.
</p>
</div>
<p>
<b>
Checkpoint.
</b>
Generally speaking, when data is saved to disk, it is said that
a
<span class="firstterm">
checkpoint
</span>
has been
reached. More specific to NDB Cluster, a checkpoint is a point
in time where all committed transactions are stored on disk.
With regard to the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage
engine, there are two types of checkpoints which work together
to ensure that a consistent view of the cluster's data is
maintained. These are shown in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="firstterm">
Local Checkpoint (LCP)
</span>
:
This is a checkpoint that is specific to a single node;
however, LCPs take place for all nodes in the cluster more or
less concurrently. An LCP 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.
</p>
<p>
NDB 8.4 supports partial LCPs, which can
significantly improve performance under some conditions. See
the descriptions of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enablepartiallcp">
<code class="literal">
EnablePartialLcp
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-recoverywork">
<code class="literal">
RecoveryWork
</code>
</a>
configuration parameters which enable partial LCPs and control
the amount of storage they use.
</p>
</li>
<li class="listitem">
<p>
<span class="firstterm">
Global Checkpoint (GCP)
</span>
:
A GCP occurs every few seconds, when transactions for all
nodes are synchronized and the redo-log is flushed to disk.
</p>
</li>
</ul>
</div>
<p>
For more information about the files and directories created by
local checkpoints and global checkpoints, see
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-ndbd-filesystemdir-files.html" target="_top">
NDB Cluster Data Node File System Directory
</a>
.
</p>
<a class="indexterm" name="idm46045124233760">
</a>
<a class="indexterm" name="idm46045124232272">
</a>
<p>
<b>
Transporter.
</b>
We use the term
<span class="firstterm">
transporter
</span>
for the data
transport mechanism employed between data nodes. MySQL NDB
Cluster 8.4 supports three of these, which are
listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
TCP/IP over Ethernet
</em>
</span>
. See
<a class="xref" href="mysql-cluster-tcp-definition.html" title="25.4.3.10 NDB Cluster TCP/IP Connections">
Section 25.4.3.10, “NDB Cluster TCP/IP Connections”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Direct TCP/IP
</em>
</span>
. Uses machine-to-machine
connections. See
<a class="xref" href="mysql-cluster-tcp-definition-direct.html" title="25.4.3.11 NDB Cluster TCP/IP Connections Using Direct Connections">
Section 25.4.3.11, “NDB Cluster TCP/IP Connections Using Direct Connections”
</a>
.
</p>
<p>
Although this transporter uses the same TCP/IP protocol as
mentioned in the previous item, it requires setting up the
hardware differently and is configured differently as well.
For this reason, it is considered a separate transport
mechanism for NDB Cluster.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Shared memory (SHM)
</em>
</span>
. See
<a class="xref" href="mysql-cluster-shm-definition.html" title="25.4.3.12 NDB Cluster Shared-Memory Connections">
Section 25.4.3.12, “NDB Cluster Shared-Memory Connections”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Because it is ubiquitous, most users employ TCP/IP over Ethernet
for NDB Cluster.
</p>
<p>
Regardless of the transporter used,
<code class="literal">
NDB
</code>
attempts to make sure that communication between data node
processes is performed using chunks that are as large as possible
since this benefits all types of data transmission.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/alter-view.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="alter-view">
</a>
15.1.11 ALTER VIEW Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045188357360">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35739202"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span>
<span class="token punctuation">[</span><span class="token keyword">ALGORITHM</span> <span class="token operator">=</span> {<span class="token keyword">UNDEFINED</span> <span class="token operator">|</span> <span class="token keyword">MERGE</span> <span class="token operator">|</span> <span class="token keyword">TEMPTABLE</span>}<span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">user</em></span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">SQL</span> <span class="token keyword">SECURITY</span> { <span class="token keyword">DEFINER</span> <span class="token operator">|</span> <span class="token keyword">INVOKER</span> }<span class="token punctuation">]</span>
<span class="token keyword">VIEW</span> <em class="replaceable">view_name</em> <span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">column_list</em><span class="token punctuation">)</span><span class="token punctuation">]</span>
<span class="token keyword">AS</span> <em class="replaceable">select_statement</em>
<span class="token punctuation">[</span><span class="token keyword">WITH</span> <span class="token punctuation">[</span><span class="token keyword">CASCADED</span> <span class="token operator">|</span> <span class="token keyword">LOCAL</span><span class="token punctuation">]</span> <span class="token keyword">CHECK</span> <span class="token keyword">OPTION</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
This statement changes the definition of a view, which must exist.
The syntax is similar to that for
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE
VIEW
</code>
</a>
see
<a class="xref" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
Section 15.1.23, “CREATE VIEW Statement”
</a>
). This statement
requires the
<a class="link" href="privileges-provided.html#priv_create-view">
<code class="literal">
CREATE VIEW
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privileges for the view, and
some privilege for each column referred to in the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement.
<a class="link" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
<code class="literal">
ALTER VIEW
</code>
</a>
is permitted only to the
definer or users with the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
or
<a class="link" href="privileges-provided.html#priv_allow-nonexistent-definer">
<code class="literal">
ALLOW_NONEXISTENT_DEFINER
</code>
</a>
privilege.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/cleartext-pluggable-authentication.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="cleartext-pluggable-authentication">
</a>
8.4.1.4 Client-Side Cleartext Pluggable Authentication
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045245966048">
</a>
<a class="indexterm" name="idm46045245964944">
</a>
<p>
A client-side authentication plugin is available that enables
clients to send passwords to the server as cleartext, without
hashing or encryption. This plugin is built into the MySQL
client library.
</p>
<p>
The following table shows the plugin name.
</p>
<div class="table">
<a name="idm46045245962352">
</a>
<p class="title">
<b>
Table 8.17 Plugin and Library Names for Cleartext Authentication
</b>
</p>
<div class="table-contents">
<table summary="Names for the plugins and library file used for cleartext password authentication.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Plugin or File
</th>
<th>
Plugin or File Name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Server-side plugin
</td>
<td>
None, see discussion
</td>
</tr>
<tr>
<td>
Client-side plugin
</td>
<td>
<code class="literal">
mysql_clear_password
</code>
</td>
</tr>
<tr>
<td>
Library file
</td>
<td>
None (plugin is built in)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Many client-side authentication plugins perform hashing or
encryption of a password before the client sends it to the
server. This enables clients to avoid sending passwords as
cleartext.
</p>
<p>
Hashing or encryption cannot be done for authentication schemes
that require the server to receive the password as entered on
the client side. In such cases, the client-side
<code class="literal">
mysql_clear_password
</code>
plugin is used, which
enables the client to send the password to the server as
cleartext. There is no corresponding server-side plugin. Rather,
<code class="literal">
mysql_clear_password
</code>
can be used on the
client side in concert with any server-side plugin that needs a
cleartext password. (Examples are the PAM and simple LDAP
authentication plugins; see
<a class="xref" href="pam-pluggable-authentication.html" title="8.4.1.5 PAM Pluggable Authentication">
Section 8.4.1.5, “PAM Pluggable Authentication”
</a>
, and
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
.)
</p>
<p>
The following discussion provides usage information specific to
cleartext pluggable authentication. For general information
about pluggable authentication in MySQL, see
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Sending passwords as cleartext may be a security problem in
some configurations. To avoid problems if there is any
possibility that the password would be intercepted, clients
should connect to MySQL Server using a method that protects
the password. Possibilities include SSL (see
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
), IPsec, or a private
network.
</p>
</div>
<p>
To make inadvertent use of the
<code class="literal">
mysql_clear_password
</code>
plugin less likely,
MySQL clients must explicitly enable it. This can be done in
several ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Set the
<code class="literal">
LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN
</code>
environment variable to a value that begins with
<code class="literal">
1
</code>
,
<code class="literal">
Y
</code>
, or
<code class="literal">
y
</code>
. This enables the plugin for all client
connections.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
,
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
,
<a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
<span class="command">
<strong>
mysqlshow
</strong>
</span>
</a>
, and
<a class="link" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
<span class="command">
<strong>
mysqlslap
</strong>
</span>
</a>
client programs support an
<code class="option">
--enable-cleartext-plugin
</code>
option that
enables the plugin on a per-invocation basis.
</p>
</li>
<li class="listitem">
<p>
The
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
C API
function supports a
<code class="literal">
MYSQL_ENABLE_CLEARTEXT_PLUGIN
</code>
option that
enables the plugin on a per-connection basis. Also, any
program that uses
<code class="literal">
libmysqlclient
</code>
and
reads option files can enable the plugin by including an
<code class="literal">
enable-cleartext-plugin
</code>
option in an
option group read by the client library.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/macos-installation-notes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="macos-installation-notes">
</a>
2.4.1 General Notes on Installing MySQL on macOS
</h3>
</div>
</div>
</div>
<p>
You should keep the following issues and notes in mind:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="bold">
<strong>
Other MySQL installations
</strong>
</span>
:
The installation procedure does not recognize MySQL
installations by package managers such as Homebrew. The
installation and upgrade process is for MySQL packages
provided by us. If other installations are present, then
consider stopping them before executing this installer to
avoid port conflicts.
</p>
<p>
<span class="bold">
<strong>
Homebrew
</strong>
</span>
: For example, if you
installed MySQL Server using Homebrew to its default location
then the MySQL installer installs to a different location and
won't upgrade the version from Homebrew. In this scenario you
would end up with multiple MySQL installations that, by
default, attempt to use the same ports. Stop the other MySQL
Server instances before running this installer, such as
executing
<span class="emphasis">
<em>
brew services stop mysql
</em>
</span>
to
stop the Homebrew's MySQL service.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Launchd
</strong>
</span>
: A launchd daemon is
installed that alters MySQL configuration options. Consider
editing it if needed, see the documentation below for
additional information. Also, macOS 10.10 removed startup item
support in favor of launchd daemons. The optional MySQL
preference pane under macOS
<span class="guilabel">
System
Preferences
</span>
uses the launchd daemon.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Users
</strong>
</span>
: You may need (or want)
to create a specific
<code class="literal">
mysql
</code>
user to own the
MySQL directory and data. You can do this through the
<span class="command">
<strong>
Directory Utility
</strong>
</span>
, and the
<code class="literal">
mysql
</code>
user should already exist. For use in
single user mode, an entry for
<code class="literal">
_mysql
</code>
(note
the underscore prefix) should already exist within the system
<code class="filename">
/etc/passwd
</code>
file.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Data
</strong>
</span>
: Because the MySQL
package installer installs the MySQL contents into a version
and platform specific directory, you can use this to upgrade
and migrate your database between versions. You need either to
copy the
<code class="filename">
data
</code>
directory from the old
version to the new version, or to specify an alternative
<code class="option">
datadir
</code>
value to set location of the data
directory. By default, the MySQL directories are installed
under
<code class="filename">
/usr/local/
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Aliases
</strong>
</span>
: You might want to
add aliases to your shell's resource file to make it easier to
access commonly used programs such as
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
and
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
from the command line. The
syntax for
<span class="command">
<strong>
bash
</strong>
</span>
is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa55902438"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">alias mysql<span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/bin/mysql</span>
alias mysqladmin<span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/bin/mysqladmin</span></code></pre>
</div>
<p>
For
<span class="command">
<strong>
tcsh
</strong>
</span>
, use:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa44753180"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">alias mysql /usr/local/mysql/bin/mysql
alias mysqladmin /usr/local/mysql/bin/mysqladmin</code></pre>
</div>
<p>
Even better, add
<code class="literal">
/usr/local/mysql/bin
</code>
to
your
<code class="literal">
PATH
</code>
environment variable. You can do
this by modifying the appropriate startup file for your shell.
For more information, see
<a class="xref" href="invoking-programs.html" title="6.2.1 Invoking MySQL Programs">
Section 6.2.1, “Invoking MySQL Programs”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Removing
</strong>
</span>
: After you have
copied over the MySQL database files from the previous
installation and have successfully started the new server, you
should consider removing the old installation files to save
disk space. Additionally, you should also remove older
versions of the Package Receipt directories located in
<code class="filename">
/Library/Receipts/mysql-
<em class="replaceable">
<code>
VERSION
</code>
</em>
.pkg
</code>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/structured-system-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="structured-system-variables">
</a>
7.1.9.5 Structured System Variables
</h4>
</div>
</div>
</div>
<p>
A structured variable differs from a regular system variable in
two respects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Its value is a structure with components that specify server
parameters considered to be closely related.
</p>
</li>
<li class="listitem">
<p>
There might be several instances of a given type of
structured variable. Each one has a different name and
refers to a different resource maintained by the server.
</p>
</li>
</ul>
</div>
<p>
MySQL supports one structured variable type, which specifies
parameters governing the operation of key caches. A key cache
structured variable has these components:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
<code class="literal">
key_buffer_size
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_key_cache_block_size">
<code class="literal">
key_cache_block_size
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_key_cache_division_limit">
<code class="literal">
key_cache_division_limit
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_key_cache_age_threshold">
<code class="literal">
key_cache_age_threshold
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
This section describes the syntax for referring to structured
variables. Key cache variables are used for syntax examples, but
specific details about how key caches operate are found
elsewhere, in
<a class="xref" href="myisam-key-cache.html" title="10.10.2 The MyISAM Key Cache">
Section 10.10.2, “The MyISAM Key Cache”
</a>
.
</p>
<p>
To refer to a component of a structured variable instance, you
can use a compound name in
<em class="replaceable">
<code>
instance_name.component_name
</code>
</em>
format.
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa97238668"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">hot_cache<span class="token punctuation">.</span>key_buffer_size
hot_cache<span class="token punctuation">.</span>key_cache_block_size
cold_cache<span class="token punctuation">.</span>key_cache_block_size</code></pre>
</div>
<p>
For each structured system variable, an instance with the name
of
<code class="literal">
default
</code>
is always predefined. If you refer
to a component of a structured variable without any instance
name, the
<code class="literal">
default
</code>
instance is used. Thus,
<code class="literal">
default.key_buffer_size
</code>
and
<a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
<code class="literal">
key_buffer_size
</code>
</a>
both refer to
the same system variable.
</p>
<p>
Structured variable instances and components follow these naming
rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For a given type of structured variable, each instance must
have a name that is unique
<span class="emphasis">
<em>
within
</em>
</span>
variables of that type. However, instance names need not be
unique
<span class="emphasis">
<em>
across
</em>
</span>
structured variable
types. For example, each structured variable has an instance
named
<code class="literal">
default
</code>
, so
<code class="literal">
default
</code>
is not unique across variable
types.
</p>
</li>
<li class="listitem">
<p>
The names of the components of each structured variable type
must be unique across all system variable names. If this
were not true (that is, if two different types of structured
variables could share component member names), it would not
be clear which default structured variable to use for
references to member names that are not qualified by an
instance name.
</p>
</li>
<li class="listitem">
<p>
If a structured variable instance name is not legal as an
unquoted identifier, refer to it as a quoted identifier
using backticks. For example,
<code class="literal">
hot-cache
</code>
is not legal, but
<code class="literal">
`hot-cache`
</code>
is.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
global
</code>
,
<code class="literal">
session
</code>
, and
<code class="literal">
local
</code>
are not legal instance names. This
avoids a conflict with notation such as
<code class="literal">
@@GLOBAL.
<em class="replaceable">
<code>
var_name
</code>
</em>
</code>
for referring to nonstructured system variables.
</p>
</li>
</ul>
</div>
<p>
Currently, the first two rules have no possibility of being
violated because the only structured variable type is the one
for key caches. These rules may assume greater significance if
some other type of structured variable is created in the future.
</p>
<p>
With one exception, you can refer to structured variable
components using compound names in any context where simple
variable names can occur. For example, you can assign a value to
a structured variable using a command-line option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa40014352"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqld</span> <span class="token constant">--hot_cache.key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>64K</span></code></pre>
</div>
<p>
In an option file, use this syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa31782184"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">hot_cache.key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>64K</span></code></pre>
</div>
<p>
If you start the server with this option, it creates a key cache
named
<code class="literal">
hot_cache
</code>
with a size of 64KB in
addition to the default key cache that has a default size of
8MB.
</p>
<p>
Suppose that you start the server as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa19928456"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqld</span> <span class="token constant">--key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>256K</span> \
<span class="token constant">--extra_cache.key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>128K</span> \
<span class="token constant">--extra_cache.key_cache_block_size</span><span class="token attr-value"><span class="token punctuation">=</span>2048</span></code></pre>
</div>
<p>
In this case, the server sets the size of the default key cache
to 256KB. (You could also have written
<code class="option">
--default.key_buffer_size=256K
</code>
.) In addition,
the server creates a second key cache named
<code class="literal">
extra_cache
</code>
that has a size of 128KB, with
the size of block buffers for caching table index blocks set to
2048 bytes.
</p>
<p>
The following example starts the server with three different key
caches having sizes in a 3:1:1 ratio:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa14940754"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqld</span> <span class="token constant">--key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>6M</span> \
<span class="token constant">--hot_cache.key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>2M</span> \
<span class="token constant">--cold_cache.key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>2M</span></code></pre>
</div>
<p>
Structured variable values may be set and retrieved at runtime
as well. For example, to set a key cache named
<code class="literal">
hot_cache
</code>
to a size of 10MB, use either of
these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65343532"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> hot_cache<span class="token punctuation">.</span>key_buffer_size <span class="token operator">=</span> <span class="token number">10</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@@GLOBAL.hot_cache.key_buffer_size</span> <span class="token operator">=</span> <span class="token number">10</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To retrieve the cache size, do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa20839712"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@GLOBAL.hot_cache.key_buffer_size</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, the following statement does not work. The variable is
not interpreted as a compound name, but as a simple string for a
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
pattern-matching operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29192983"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'hot_cache.key_buffer_size'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This is the exception to being able to use structured variable
names anywhere a simple variable name may occur.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-datafiles-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-datafiles-table">
</a>
28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045077087584">
</a>
<p>
The
<a class="link" href="information-schema-innodb-datafiles-table.html" title="28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table">
<code class="literal">
INNODB_DATAFILES
</code>
</a>
table provides
data file path information for
<code class="literal">
InnoDB
</code>
file-per-table and general tablespaces.
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-system-tables.html" title="17.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables">
Section 17.15.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table reports metadata for
<code class="literal">
InnoDB
</code>
tablespace types including
file-per-table tablespaces, general tablespaces, the system
tablespace, the global temporary tablespace, and undo
tablespaces.
</p>
</div>
<p>
The
<a class="link" href="information-schema-innodb-datafiles-table.html" title="28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table">
<code class="literal">
INNODB_DATAFILES
</code>
</a>
table has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SPACE
</code>
</p>
<p>
The tablespace ID.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PATH
</code>
</p>
<p>
The tablespace data file path. If a
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
tablespace is created in a location outside the MySQL data
directory, the path value is a fully qualified directory path.
Otherwise, the path is relative to the data directory.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045077071728">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63270295"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_DATAFILES <span class="token keyword">WHERE</span> SPACE <span class="token operator">=</span> <span class="token number">57</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
SPACE<span class="token punctuation">:</span> 57
PATH<span class="token punctuation">:</span> ./test/t1.ibd</span></code></pre>
</div>
<h4>
<a name="idm46045077069264">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You must have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege to query this table.
</p>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
table or the
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
statement to view
additional information about the columns of this table,
including data types and default values.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-arbitrator-validity-summary.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-arbitrator-validity-summary">
</a>
25.6.17.2 The ndbinfo arbitrator_validity_summary Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045090531568">
</a>
<p>
The
<code class="literal">
arbitrator_validity_summary
</code>
table
provides a composite view of the arbitrator with regard to the
cluster's data nodes.
</p>
<p>
The
<code class="literal">
arbitrator_validity_summary
</code>
table
contains the following columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
arbitrator
</code>
</p>
<p>
Node ID of arbitrator
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arb_ticket
</code>
</p>
<p>
Internal identifier used to track arbitration
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arb_connected
</code>
</p>
<p>
Whether this arbitrator is connected to the cluster
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
consensus_count
</code>
</p>
<p>
Number of data nodes that see this node as arbitrator;
either of
<code class="literal">
Yes
</code>
or
<code class="literal">
No
</code>
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045090518192">
</a>
Notes
</h5>
<p>
In normal operations, this table should have only 1 row for any
appreciable length of time. If it has more than 1 row for longer
than a few moments, then either not all nodes are connected to
the arbitrator, or all nodes are connected, but do not agree on
the same arbitrator.
</p>
<p>
The
<code class="literal">
arbitrator
</code>
column shows the
arbitrator's node ID.
</p>
<p>
<code class="literal">
arb_ticket
</code>
is the internal identifier used by
this arbitrator.
</p>
<p>
<code class="literal">
arb_connected
</code>
shows whether this node is
connected to the cluster as an arbitrator.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-information-schema-tables">
</a>
28.4 INFORMATION_SCHEMA InnoDB Tables
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="information-schema-innodb-table-reference.html">
28.4.1 INFORMATION_SCHEMA InnoDB Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-page-table.html">
28.4.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-page-lru-table.html">
28.4.3 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-pool-stats-table.html">
28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cached-indexes-table.html">
28.4.5 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmp-table.html">
28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmpmem-table.html">
28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmp-per-index-table.html">
28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-columns-table.html">
28.4.9 The INFORMATION_SCHEMA INNODB_COLUMNS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-datafiles-table.html">
28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-fields-table.html">
28.4.11 The INFORMATION_SCHEMA INNODB_FIELDS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-foreign-table.html">
28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-foreign-cols-table.html">
28.4.13 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-being-deleted-table.html">
28.4.14 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-config-table.html">
28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-default-stopword-table.html">
28.4.16 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-deleted-table.html">
28.4.17 The INFORMATION_SCHEMA INNODB_FT_DELETED Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-index-cache-table.html">
28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-index-table-table.html">
28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-indexes-table.html">
28.4.20 The INFORMATION_SCHEMA INNODB_INDEXES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-metrics-table.html">
28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-session-temp-tablespaces-table.html">
28.4.22 The INFORMATION_SCHEMA INNODB_SESSION_TEMP_TABLESPACES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tables-table.html">
28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablespaces-table.html">
28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablespaces-brief-table.html">
28.4.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablestats-table.html">
28.4.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-temp-table-info-table.html">
28.4.27 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-trx-table.html">
28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-virtual-table.html">
28.4.29 The INFORMATION_SCHEMA INNODB_VIRTUAL Table
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045077910672">
</a>
<a class="indexterm" name="idm46045077909184">
</a>
<p>
This section provides table definitions for
<code class="literal">
INFORMATION_SCHEMA
</code>
<code class="literal">
InnoDB
</code>
tables. For related information and examples, see
<a class="xref" href="innodb-information-schema.html" title="17.15 InnoDB INFORMATION_SCHEMA Tables">
Section 17.15, “InnoDB INFORMATION_SCHEMA Tables”
</a>
.
</p>
<p>
<code class="literal">
INFORMATION_SCHEMA
</code>
<code class="literal">
InnoDB
</code>
tables can be used to monitor ongoing
<code class="literal">
InnoDB
</code>
activity, to detect inefficiencies before they turn into issues, or
to troubleshoot performance and capacity issues. As your database
becomes bigger and busier, running up against the limits of your
hardware capacity, you monitor and tune these aspects to keep the
database running smoothly.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/audit-log-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="audit-log-security">
</a>
8.4.5.3 MySQL Enterprise Audit Security Considerations
</h4>
</div>
</div>
</div>
<p>
By default, contents of audit log files produced by the audit
log plugin are not encrypted and may contain sensitive
information, such as the text of SQL statements. For security
reasons, audit log files should be written to a directory
accessible only to the MySQL server and to users with a
legitimate reason to view the log. The default file name is
<code class="filename">
audit.log
</code>
in the data directory. This can
be changed by setting the
<a class="link" href="audit-log-reference.html#sysvar_audit_log_file">
<code class="literal">
audit_log_file
</code>
</a>
system variable
at server startup. Other audit log files may exist due to log
rotation.
</p>
<p>
For additional security, enable audit log file encryption. See
<a class="xref" href="audit-log-logging-configuration.html#audit-log-file-encryption" title="Encrypting Audit Log Files">
Encrypting Audit Log Files
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/end-markers-in-json-system-variable.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="end-markers-in-json-system-variable">
</a>
10.15.9 The end_markers_in_json System Variable
</h3>
</div>
</div>
</div>
<p>
When reading a very large JSON document, it can be difficult to
pair its closing bracket and opening brackets; setting
<code class="literal">
end_markers_in_json=ON
</code>
repeats the
structure's key, if it has one, near the closing bracket.
This variable affects both optimizer traces and the output of
<code class="literal">
EXPLAIN FORMAT=JSON
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If
<code class="literal">
end_markers_in_json
</code>
is enabled, the
repetition of the key means the result is not a valid JSON
document, and causes JSON parsers to throw an error.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimization.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="optimization">
</a>
Chapter 10 Optimization
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="optimize-overview.html">
10.1 Optimization Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="statement-optimization.html">
10.2 Optimizing SQL Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="select-optimization.html">
10.2.1 Optimizing SELECT Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="subquery-optimization.html">
10.2.2 Optimizing Subqueries, Derived Tables, View References, and Common Table
Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-optimization.html">
10.2.3 Optimizing INFORMATION_SCHEMA Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-optimization.html">
10.2.4 Optimizing Performance Schema Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-change-optimization.html">
10.2.5 Optimizing Data Change Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="permission-optimization.html">
10.2.6 Optimizing Database Privileges
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="miscellaneous-optimization-tips.html">
10.2.7 Other Optimization Tips
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimization-indexes.html">
10.3 Optimization and Indexes
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-indexes.html">
10.3.1 How MySQL Uses Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="primary-key-optimization.html">
10.3.2 Primary Key Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-index-optimization.html">
10.3.3 SPATIAL Index Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="foreign-key-optimization.html">
10.3.4 Foreign Key Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="column-indexes.html">
10.3.5 Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-column-indexes.html">
10.3.6 Multiple-Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="verifying-index-usage.html">
10.3.7 Verifying Index Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-statistics.html">
10.3.8 InnoDB and MyISAM Index Statistics Collection
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-btree-hash.html">
10.3.9 Comparison of B-Tree and Hash Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-extensions.html">
10.3.10 Use of Index Extensions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="generated-column-index-optimizations.html">
10.3.11 Optimizer Use of Generated Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="invisible-indexes.html">
10.3.12 Invisible Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="descending-indexes.html">
10.3.13 Descending Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="timestamp-lookups.html">
10.3.14 Indexed Lookups from TIMESTAMP Columns
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-database-structure.html">
10.4 Optimizing Database Structure
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="data-size.html">
10.4.1 Optimizing Data Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-data-types.html">
10.4.2 Optimizing MySQL Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-multi-tables.html">
10.4.3 Optimizing for Many Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="internal-temporary-tables.html">
10.4.4 Internal Temporary Table Use in MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="database-count-limit.html">
10.4.5 Limits on Number of Databases and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-size-limit.html">
10.4.6 Limits on Table Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="column-count-limit.html">
10.4.7 Limits on Table Column Count and Row Size
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-innodb.html">
10.5 Optimizing for InnoDB Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizing-innodb-storage-layout.html">
10.5.1 Optimizing Storage Layout for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-transaction-management.html">
10.5.2 Optimizing InnoDB Transaction Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-ro-txn.html">
10.5.3 Optimizing InnoDB Read-Only Transactions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-logging.html">
10.5.4 Optimizing InnoDB Redo Logging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-bulk-data-loading.html">
10.5.5 Bulk Data Loading for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-queries.html">
10.5.6 Optimizing InnoDB Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-ddl-operations.html">
10.5.7 Optimizing InnoDB DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-diskio.html">
10.5.8 Optimizing InnoDB Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-configuration-variables.html">
10.5.9 Optimizing InnoDB Configuration Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-many-tables.html">
10.5.10 Optimizing InnoDB for Systems with Many Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-myisam.html">
10.6 Optimizing for MyISAM Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizing-queries-myisam.html">
10.6.1 Optimizing MyISAM Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-myisam-bulk-data-loading.html">
10.6.2 Bulk Data Loading for MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="repair-table-optimization.html">
10.6.3 Optimizing REPAIR TABLE Statements
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-memory-tables.html">
10.7 Optimizing for MEMORY Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="execution-plan-information.html">
10.8 Understanding the Query Execution Plan
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="using-explain.html">
10.8.1 Optimizing Queries with EXPLAIN
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-output.html">
10.8.2 EXPLAIN Output Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-extended.html">
10.8.3 Extended EXPLAIN Output Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-for-connection.html">
10.8.4 Obtaining Execution Plan Information for a Named Connection
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="estimating-performance.html">
10.8.5 Estimating Query Performance
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="controlling-optimizer.html">
10.9 Controlling the Query Optimizer
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="controlling-query-plan-evaluation.html">
10.9.1 Controlling Query Plan Evaluation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="switchable-optimizations.html">
10.9.2 Switchable Optimizations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-hints.html">
10.9.3 Optimizer Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-hints.html">
10.9.4 Index Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="cost-model.html">
10.9.5 The Optimizer Cost Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-statistics.html">
10.9.6 Optimizer Statistics
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="buffering-caching.html">
10.10 Buffering and Caching
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-buffer-pool-optimization.html">
10.10.1 InnoDB Buffer Pool Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-key-cache.html">
10.10.2 The MyISAM Key Cache
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="statement-caching.html">
10.10.3 Caching of Prepared Statements and Stored Programs
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="locking-issues.html">
10.11 Optimizing Locking Operations
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="internal-locking.html">
10.11.1 Internal Locking Methods
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-locking.html">
10.11.2 Table Locking Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="concurrent-inserts.html">
10.11.3 Concurrent Inserts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="metadata-locking.html">
10.11.4 Metadata Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="external-locking.html">
10.11.5 External Locking
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-server.html">
10.12 Optimizing the MySQL Server
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="disk-issues.html">
10.12.1 Optimizing Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="symbolic-links.html">
10.12.2 Using Symbolic Links
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-memory.html">
10.12.3 Optimizing Memory Use
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimize-benchmarking.html">
10.13 Measuring Performance (Benchmarking)
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="select-benchmarking.html">
10.13.1 Measuring the Speed of Expressions and Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="custom-benchmarks.html">
10.13.2 Using Your Own Benchmarks
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitoring-performance-schema.html">
10.13.3 Measuring Performance with performance_schema
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="thread-information.html">
10.14 Examining Server Thread (Process) Information
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="processlist-access.html">
10.14.1 Accessing the Process List
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="thread-commands.html">
10.14.2 Thread Command Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="general-thread-states.html">
10.14.3 General Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-thread-states.html">
10.14.4 Replication Source Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-io-thread-states.html">
10.14.5 Replication I/O (Receiver) Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-sql-thread-states.html">
10.14.6 Replication SQL Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-connection-thread-states.html">
10.14.7 Replication Connection Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-thread-states.html">
10.14.8 NDB Cluster Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="event-scheduler-thread-states.html">
10.14.9 Event Scheduler Thread States
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizer-tracing.html">
10.15 Tracing the Optimizer
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizer-tracing-typical-usage.html">
10.15.1 Typical Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="system-variables-controlling-tracing.html">
10.15.2 System Variables Controlling Tracing
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="traceable-statements.html">
10.15.3 Traceable Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tuning-trace-purging.html">
10.15.4 Tuning Trace Purging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tracing-memory-usage.html">
10.15.5 Tracing Memory Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privilege-checking.html">
10.15.6 Privilege Checking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="interaction-with-debug-option.html">
10.15.7 Interaction with the --debug Option
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-system-variable.html">
10.15.8 The optimizer_trace System Variable
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="end-markers-in-json-system-variable.html">
10.15.9 The end_markers_in_json System Variable
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-features-to-trace.html">
10.15.10 Selecting Optimizer Features to Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="trace-general-structure.html">
10.15.11 Trace General Structure
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tracing-example.html">
10.15.12 Example
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="displaying-traces.html">
10.15.13 Displaying Traces in Other Applications
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="preventing-use-of-optimizer-trace.html">
10.15.14 Preventing the Use of Optimizer Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-testing.html">
10.15.15 Testing Optimizer Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-implementation.html">
10.15.16 Optimizer Trace Implementation
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<a class="indexterm" name="idm46045230418656">
</a>
<a class="indexterm" name="idm46045230417584">
</a>
<a class="indexterm" name="idm46045230416512">
</a>
<p>
This chapter explains how to optimize MySQL performance and provides
examples. Optimization involves configuring, tuning, and measuring
performance, at several levels. Depending on your job role
(developer, DBA, or a combination of both), you might optimize at
the level of individual SQL statements, entire applications, a
single database server, or multiple networked database servers.
Sometimes you can be proactive and plan in advance for performance,
while other times you might troubleshoot a configuration or code
issue after a problem occurs. Optimizing CPU and memory usage can
also improve scalability, allowing the database to handle more load
without slowing down.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/statement-caching.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="statement-caching">
</a>
10.10.3 Caching of Prepared Statements and Stored Programs
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045222973600">
</a>
<a class="indexterm" name="idm46045222972144">
</a>
<p>
For certain statements that a client might execute multiple
times during a session, the server converts the statement to an
internal structure and caches that structure to be used during
execution. Caching enables the server to perform more
efficiently because it avoids the overhead of reconverting the
statement should it be needed again during the session.
Conversion and caching occurs for these statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Prepared statements, both those processed at the SQL level
(using the
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
statement)
and those processed using the binary client/server protocol
(using the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-stmt-prepare.html" target="_top">
<code class="literal">
mysql_stmt_prepare()
</code>
</a>
C API
function). The
<a class="link" href="server-system-variables.html#sysvar_max_prepared_stmt_count">
<code class="literal">
max_prepared_stmt_count
</code>
</a>
system variable controls the total number of statements the
server caches. (The sum of the number of prepared statements
across all sessions.)
</p>
</li>
<li class="listitem">
<p>
Stored programs (stored procedures and functions, triggers,
and events). In this case, the server converts and caches
the entire program body. The
<a class="link" href="server-system-variables.html#sysvar_stored_program_cache">
<code class="literal">
stored_program_cache
</code>
</a>
system
variable indicates the approximate number of stored programs
the server caches per session.
</p>
</li>
</ul>
</div>
<p>
The server maintains caches for prepared statements and stored
programs on a per-session basis. Statements cached for one
session are not accessible to other sessions. When a session
ends, the server discards any statements cached for it.
</p>
<p>
When the server uses a cached internal statement structure, it
must take care that the structure does not go out of date.
Metadata changes can occur for an object used by the statement,
causing a mismatch between the current object definition and the
definition as represented in the internal statement structure.
Metadata changes occur for DDL statements such as those that
create, drop, alter, rename, or truncate tables, or that
analyze, optimize, or repair tables. Table content changes (for
example, with
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
) do not change metadata,
nor do
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements.
</p>
<p>
Here is an illustration of the problem. Suppose that a client
prepares this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa73258207"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">PREPARE</span> s1 <span class="token keyword">FROM</span> <span class="token string">'SELECT * FROM t1'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
SELECT *
</code>
expands in the internal
structure to the list of columns in the table. If the set of
columns in the table is modified with
<code class="literal">
ALTER
TABLE
</code>
, the prepared statement goes out of date. If the
server does not detect this change the next time the client
executes
<code class="literal">
s1
</code>
, the prepared statement returns
incorrect results.
</p>
<p>
To avoid problems caused by metadata changes to tables or views
referred to by the prepared statement, the server detects these
changes and automatically reprepares the statement when it is
next executed. That is, the server reparses the statement and
rebuilds the internal structure. Reparsing 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
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH
TABLES
</code>
</a>
.
</p>
<p>
Similarly, if changes occur to objects used by a stored program,
the server reparses affected statements within the program.
</p>
<p>
The server also detects metadata changes for objects in
expressions. These might be used in statements specific to
stored programs, such as
<code class="literal">
DECLARE CURSOR
</code>
or
flow-control statements such as
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
,
<a class="link" href="case.html" title="15.6.5.1 CASE Statement">
<code class="literal">
CASE
</code>
</a>
, and
<a class="link" href="return.html" title="15.6.5.7 RETURN Statement">
<code class="literal">
RETURN
</code>
</a>
.
</p>
<p>
To avoid reparsing entire stored programs, the server reparses
affected statements or expressions within a program only as
needed. Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Suppose that metadata for a table or view is changed.
Reparsing occurs for a
<code class="literal">
SELECT *
</code>
within
the program that accesses the table or view, but not for a
<code class="literal">
SELECT *
</code>
that does not access the table
or view.
</p>
</li>
<li class="listitem">
<p>
When a statement is affected, the server reparses it only
partially if possible. Consider this
<a class="link" href="case.html" title="15.6.5.1 CASE Statement">
<code class="literal">
CASE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33214601"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">CASE</span> <em class="replaceable">case_expr</em>
<span class="token keyword">WHEN</span> <em class="replaceable">when_expr1</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">WHEN</span> <em class="replaceable">when_expr2</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">WHEN</span> <em class="replaceable">when_expr3</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">END</span> <span class="token operator">CASE</span></code></pre>
</div>
<p>
If a metadata change affects only
<code class="literal">
WHEN
<em class="replaceable">
<code>
when_expr3
</code>
</em>
</code>
, that
expression is reparsed.
<em class="replaceable">
<code>
case_expr
</code>
</em>
and the other
<code class="literal">
WHEN
</code>
expressions are not
reparsed.
</p>
</li>
</ul>
</div>
<p>
Reparsing uses the default database and SQL mode that were in
effect for the original conversion to internal form.
</p>
<p>
The server attempts reparsing up to three times. An error occurs
if all attempts fail.
</p>
<p>
Reparsing is automatic, but to the extent that it occurs,
diminishes prepared statement and stored program performance.
</p>
<p>
For prepared statements, the
<a class="link" href="server-status-variables.html#statvar_Com_xxx">
<code class="literal">
Com_stmt_reprepare
</code>
</a>
status variable tracks the number of repreparations.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/drop-database.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="drop-database">
</a>
15.1.24 DROP DATABASE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045183526912">
</a>
<a class="indexterm" name="idm46045183525840">
</a>
<a class="indexterm" name="idm46045183524768">
</a>
<a class="indexterm" name="idm46045183523280">
</a>
<a class="indexterm" name="idm46045183521792">
</a>
<a class="indexterm" name="idm46045183520304">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa11072706"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> {<span class="token keyword">DATABASE</span> <span class="token operator">|</span> <span class="token keyword">SCHEMA</span>} <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <em class="replaceable">db_name</em></code></pre>
</div>
<p>
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
drops all tables in
the database and deletes the database. Be
<span class="emphasis">
<em>
very
</em>
</span>
careful with this statement! To use
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
, you need the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege on the database.
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP
SCHEMA
</code>
</a>
is a synonym for
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP
DATABASE
</code>
</a>
.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When a database is dropped, privileges granted specifically for
the database are
<span class="emphasis">
<em>
not
</em>
</span>
automatically dropped.
They must be dropped manually. See
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
.
</p>
</div>
<p>
<code class="literal">
IF EXISTS
</code>
is used to prevent an error from
occurring if the database does not exist.
</p>
<p>
If the default database is dropped, the default database is unset
(the
<a class="link" href="information-functions.html#function_database">
<code class="literal">
DATABASE()
</code>
</a>
function returns
<code class="literal">
NULL
</code>
).
</p>
<p>
If you use
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
on a
symbolically linked database, both the link and the original
database are deleted.
</p>
<p>
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
returns the number of
tables that were removed.
</p>
<p>
The
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
statement removes
from the given database directory those files and directories that
MySQL itself may create during normal operation. This includes all
files with the extensions shown in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="filename">
.BAK
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.DAT
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.HSH
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.MRG
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.MYD
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.MYI
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.cfg
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.db
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.ibd
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
.ndb
</code>
</p>
</li>
</ul>
</div>
<p>
If other files or directories remain in the database directory
after MySQL removes those just listed, the database directory
cannot be removed. In this case, you must remove any remaining
files or directories manually and issue the
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
statement again.
</p>
<p>
Dropping a database does not remove any
<code class="literal">
TEMPORARY
</code>
tables that were created in that
database.
<code class="literal">
TEMPORARY
</code>
tables are automatically
removed when the session that created them ends. See
<a class="xref" href="create-temporary-table.html" title="15.1.20.2 CREATE TEMPORARY TABLE Statement">
Section 15.1.20.2, “CREATE TEMPORARY TABLE Statement”
</a>
.
</p>
<a class="indexterm" name="idm46045183476080">
</a>
<p>
You can also drop databases with
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
.
See
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl-space-requirements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-online-ddl-space-requirements">
</a>
17.12.3 Online DDL Space Requirements
</h3>
</div>
</div>
</div>
<p>
Disk space requirements for online DDL operations are outlined
below. The requirements do not apply to operations that are
performed instantly.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Temporary log files:
</p>
<p>
A temporary log file records concurrent DML when an online DDL
operation creates an index or alters a table. The temporary
log file is extended as required by the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_sort_buffer_size">
<code class="literal">
innodb_sort_buffer_size
</code>
</a>
up to
a maximum specified by
<a class="link" href="innodb-parameters.html#sysvar_innodb_online_alter_log_max_size">
<code class="literal">
innodb_online_alter_log_max_size
</code>
</a>
.
If the operation takes a long time and concurrent DML modifies
the table so much that the size of the temporary log file
exceeds the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_online_alter_log_max_size">
<code class="literal">
innodb_online_alter_log_max_size
</code>
</a>
,
the online DDL operation fails with a
<code class="literal">
DB_ONLINE_LOG_TOO_BIG
</code>
error, and
uncommitted concurrent DML operations are rolled back. A large
<a class="link" href="innodb-parameters.html#sysvar_innodb_online_alter_log_max_size">
<code class="literal">
innodb_online_alter_log_max_size
</code>
</a>
setting permits more DML during an online DDL operation, but
it also extends the period of time at the end of the DDL
operation when the table is locked to apply logged DML.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_sort_buffer_size">
<code class="literal">
innodb_sort_buffer_size
</code>
</a>
variable also defines the size of the temporary log file read
buffer and write buffer.
</p>
</li>
<li class="listitem">
<p>
Temporary sort files:
</p>
<p>
Online DDL operations that rebuild the table write temporary
sort files to the MySQL temporary directory
(
<code class="literal">
$TMPDIR
</code>
on Unix,
<code class="literal">
%TEMP%
</code>
on Windows, or the directory specified by
<a class="link" href="server-system-variables.html#sysvar_tmpdir">
<code class="literal">
--tmpdir
</code>
</a>
) during index
creation. Temporary sort files are not created in the
directory that contains the original table. Each temporary
sort file is large enough to hold one column of data, and each
sort file is removed when its data is merged into the final
table or index. Operations involving temporary sort files may
require temporary space equal to the amount of data in the
table plus indexes. An error is reported if online DDL
operation uses all of the available disk space on the file
system where the data directory resides.
</p>
<p>
If the MySQL temporary directory is not large enough to hold
the sort files, set
<a class="link" href="server-system-variables.html#sysvar_tmpdir">
<code class="literal">
tmpdir
</code>
</a>
to
a different directory. Alternatively, define a separate
temporary directory for online DDL operations using
<a class="link" href="innodb-parameters.html#sysvar_innodb_tmpdir">
<code class="literal">
innodb_tmpdir
</code>
</a>
. This option
was introduced to help avoid temporary directory overflows
that could occur as a result of large temporary sort files.
</p>
</li>
<li class="listitem">
<p>
Intermediate table files:
</p>
<p>
Some online DDL operations that rebuild the table create a
temporary intermediate table file in the same directory as the
original table. An intermediate table file may require space
equal to the size of the original table. Intermediate table
file names begin with
<code class="filename">
#sql-ib
</code>
prefix and
only appear briefly during the online DDL operation.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_tmpdir">
<code class="literal">
innodb_tmpdir
</code>
</a>
option is
not applicable to intermediate table files.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-logbuffers.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-logbuffers">
</a>
25.6.17.43 The ndbinfo logbuffers Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089006976">
</a>
<p>
The
<code class="literal">
logbuffer
</code>
table provides information on
NDB Cluster log buffer usage.
</p>
<p>
The
<code class="literal">
logbuffers
</code>
table contains the following
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
node_id
</code>
</p>
<p>
The ID of this data node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_type
</code>
</p>
<p>
Type of log. One of:
<code class="literal">
REDO
</code>
,
<code class="literal">
DD-UNDO
</code>
,
<code class="literal">
BACKUP-DATA
</code>
,
or
<code class="literal">
BACKUP-LOG
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_id
</code>
</p>
<p>
The log ID; for Disk Data undo log files, this is the same
as the value shown in the
<code class="literal">
LOGFILE_GROUP_NUMBER
</code>
column of the
Information Schema
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table
as well as the value shown for the
<code class="literal">
log_id
</code>
column of the
<code class="literal">
ndbinfo
</code>
<a class="link" href="mysql-cluster-ndbinfo-logspaces.html" title="25.6.17.44 The ndbinfo logspaces Table">
<code class="literal">
logspaces
</code>
</a>
table
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_part
</code>
</p>
<p>
The log part number
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
Total space available for this log
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
used
</code>
</p>
<p>
Space used by this log
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045088983600">
</a>
Notes
</h5>
<p>
<code class="literal">
logbuffers
</code>
table rows reflecting two
additional log types are available when performing an NDB
backup. One of these rows has the log type
<code class="literal">
BACKUP-DATA
</code>
, which shows the amount of data
buffer used during backup to copy fragments to backup files. The
other row has the log type
<code class="literal">
BACKUP-LOG
</code>
, which
displays the amount of log buffer used during the backup to
record changes made after the backup has started. One each of
these
<code class="literal">
log_type
</code>
rows is shown in the
<code class="literal">
logbuffers
</code>
table for each data node in the
cluster. These rows are not present unless an NDB backup is
currently being performed.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fulltext-boolean.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fulltext-boolean">
</a>
14.9.2 Boolean Full-Text Searches
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045201825488">
</a>
<a class="indexterm" name="idm46045201824448">
</a>
<p>
MySQL can perform boolean full-text searches using the
<code class="literal">
IN BOOLEAN MODE
</code>
modifier. With this modifier,
certain characters have special meaning at the beginning or end
of words in the search string. In the following query, the
<code class="literal">
+
</code>
and
<code class="literal">
-
</code>
operators indicate
that a word must be present or absent, respectively, for a match
to occur. Thus, the query retrieves all the rows that contain
the word
<span class="quote">
“
<span class="quote">
MySQL
</span>
”
</span>
but that do
<span class="emphasis">
<em>
not
</em>
</span>
contain the word
<span class="quote">
“
<span class="quote">
YourSQL
</span>
”
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88474055"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> articles <span class="token keyword">WHERE</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'+MySQL -YourSQL'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> title <span class="token punctuation">|</span> body <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> MySQL Tutorial <span class="token punctuation">|</span> DBMS stands for DataBase ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> How To Use MySQL Well <span class="token punctuation">|</span> After you went through a ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> Optimizing MySQL <span class="token punctuation">|</span> In this tutorial, we show ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 1001 MySQL Tricks <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> MySQL Security <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In implementing this feature, MySQL uses what is sometimes
referred to as
<span class="firstterm">
implied Boolean
logic
</span>
, in which
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
+
</code>
stands for
<code class="literal">
AND
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
-
</code>
stands for
<code class="literal">
NOT
</code>
</p>
</li>
<li class="listitem">
<p>
[
<span class="emphasis">
<em>
no operator
</em>
</span>
] implies
<code class="literal">
OR
</code>
</p>
</li>
</ul>
</div>
</div>
<p>
Boolean full-text searches have these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
They do not automatically sort rows in order of decreasing
relevance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
tables require a
<code class="literal">
FULLTEXT
</code>
index on all columns of the
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
expression to perform
boolean queries. Boolean queries against a
<code class="literal">
MyISAM
</code>
search index can work even without
a
<code class="literal">
FULLTEXT
</code>
index, although a search
executed in this fashion would be quite slow.
</p>
</li>
<li class="listitem">
<p>
The minimum and maximum word length full-text parameters
apply to
<code class="literal">
FULLTEXT
</code>
indexes created using
the built-in
<code class="literal">
FULLTEXT
</code>
parser and MeCab
parser plugin.
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
<code class="literal">
innodb_ft_min_token_size
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
<code class="literal">
innodb_ft_max_token_size
</code>
</a>
are used for
<code class="literal">
InnoDB
</code>
search indexes.
<a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
<code class="literal">
ft_min_word_len
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
<code class="literal">
ft_max_word_len
</code>
</a>
are used
for
<code class="literal">
MyISAM
</code>
search indexes.
</p>
<p>
Minimum and maximum word length full-text parameters do not
apply to
<code class="literal">
FULLTEXT
</code>
indexes created using
the ngram parser. ngram token size is defined by the
<a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
<code class="literal">
ngram_token_size
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
The stopword list applies, controlled by
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_enable_stopword">
<code class="literal">
innodb_ft_enable_stopword
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_server_stopword_table">
<code class="literal">
innodb_ft_server_stopword_table
</code>
</a>
,
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_user_stopword_table">
<code class="literal">
innodb_ft_user_stopword_table
</code>
</a>
for
<code class="literal">
InnoDB
</code>
search indexes, and
<a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
<code class="literal">
ft_stopword_file
</code>
</a>
for
<code class="literal">
MyISAM
</code>
ones.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
full-text search does not support
the use of multiple operators on a single search word, as in
this example:
<code class="literal">
'++apple'
</code>
. Use of multiple
operators on a single search word returns a syntax error to
standard out. MyISAM full-text search successfully processes
the same search, ignoring all operators except for the
operator immediately adjacent to the search word.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
full-text search only supports
leading plus or minus signs. For example,
<code class="literal">
InnoDB
</code>
supports
<code class="literal">
'+apple'
</code>
but does not support
<code class="literal">
'apple+'
</code>
. Specifying a trailing plus or
minus sign causes
<code class="literal">
InnoDB
</code>
to report a
syntax error.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
full-text search does not support
the use of a leading plus sign with wildcard
(
<code class="literal">
'+*'
</code>
), a plus and minus sign combination
(
<code class="literal">
'+-'
</code>
), or leading a plus and minus sign
combination (
<code class="literal">
'+-apple'
</code>
). These invalid
queries return a syntax error.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
full-text search does not support
the use of the
<code class="literal">
@
</code>
symbol in boolean
full-text searches. The
<code class="literal">
@
</code>
symbol is
reserved for use by the
<code class="literal">
@distance
</code>
proximity search operator.
</p>
</li>
<li class="listitem">
<p>
They do not use the 50% threshold that applies to
<code class="literal">
MyISAM
</code>
search indexes.
</p>
</li>
</ul>
</div>
<p>
The boolean full-text search capability supports the following
operators:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
+
</code>
</p>
<p>
A leading or trailing plus sign indicates that this word
<span class="emphasis">
<em>
must
</em>
</span>
be present in each row that is
returned.
<code class="literal">
InnoDB
</code>
only supports leading
plus signs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
-
</code>
</p>
<p>
A leading or trailing minus sign indicates that this word
must
<span class="emphasis">
<em>
not
</em>
</span>
be present in any of the rows
that are returned.
<code class="literal">
InnoDB
</code>
only supports
leading minus signs.
</p>
<p>
Note: The
<code class="literal">
-
</code>
operator acts only to exclude
rows that are otherwise matched by other search terms. Thus,
a boolean-mode search that contains only terms preceded by
<code class="literal">
-
</code>
returns an empty result. It does not
return
<span class="quote">
“
<span class="quote">
all rows except those containing any of the
excluded terms.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
(no operator)
</p>
<p>
By default (when neither
<code class="literal">
+
</code>
nor
<code class="literal">
-
</code>
is specified), the word is optional,
but the rows that contain it are rated higher. This mimics
the behavior of
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
AGAINST()
</code>
</a>
without the
<code class="literal">
IN BOOLEAN
MODE
</code>
modifier.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
@
<em class="replaceable">
<code>
distance
</code>
</em>
</code>
</p>
<p>
This operator works on
<code class="literal">
InnoDB
</code>
tables
only. It tests whether two or more words all start within a
specified distance from each other, measured in words.
Specify the search words within a double-quoted string
immediately before the
<code class="literal">
@
<em class="replaceable">
<code>
distance
</code>
</em>
</code>
operator, for example,
<code class="literal">
MATCH(col1) AGAINST('"word1
word2 word3" @8' IN BOOLEAN MODE)
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
> <
</code>
</p>
<p>
These two operators are used to change a word's contribution
to the relevance value that is assigned to a row. The
<code class="literal">
>
</code>
operator increases the contribution
and the
<code class="literal">
<
</code>
operator decreases it. See
the example following this list.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
( )
</code>
</p>
<p>
Parentheses group words into subexpressions. Parenthesized
groups can be nested.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
~
</code>
</p>
<p>
A leading tilde acts as a negation operator, causing the
word's contribution to the row's relevance to be negative.
This is useful for marking
<span class="quote">
“
<span class="quote">
noise
</span>
”
</span>
words. A row
containing such a word is rated lower than others, but is
not excluded altogether, as it would be with the
<code class="literal">
-
</code>
operator.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
*
</code>
</p>
<p>
The asterisk serves as the truncation (or wildcard)
operator. Unlike the other operators, it is
<span class="emphasis">
<em>
appended
</em>
</span>
to the word to be affected.
Words match if they begin with the word preceding the
<code class="literal">
*
</code>
operator.
</p>
<p>
If a word is specified with the truncation operator, it is
not stripped from a boolean query, even if it is too short
or a stopword. Whether a word is too short is determined
from the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
<code class="literal">
innodb_ft_min_token_size
</code>
</a>
setting for
<code class="literal">
InnoDB
</code>
tables, or
<a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
<code class="literal">
ft_min_word_len
</code>
</a>
for
<code class="literal">
MyISAM
</code>
tables. These options are not
applicable to
<code class="literal">
FULLTEXT
</code>
indexes that use
the ngram parser.
</p>
<p>
The wildcarded word is considered as a prefix that must be
present at the start of one or more words. If the minimum
word length is 4, a search for
<code class="literal">
'+
<em class="replaceable">
<code>
word
</code>
</em>
+the*'
</code>
could return fewer rows than a search for
<code class="literal">
'+
<em class="replaceable">
<code>
word
</code>
</em>
+the'
</code>
,
because the second query ignores the too-short search term
<code class="literal">
the
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
"
</code>
</p>
<p>
A phrase that is enclosed within double quote
(
<code class="literal">
"
</code>
) characters matches only rows that
contain the phrase
<span class="emphasis">
<em>
literally, as it was
typed
</em>
</span>
. The full-text engine splits the phrase
into words and performs a search in the
<code class="literal">
FULLTEXT
</code>
index for the words. Nonword
characters need not be matched exactly: Phrase searching
requires only that matches contain exactly the same words as
the phrase and in the same order. For example,
<code class="literal">
"test phrase"
</code>
matches
<code class="literal">
"test,
phrase"
</code>
.
</p>
<p>
If the phrase contains no words that are in the index, the
result is empty. The words might not be in the index because
of a combination of factors: if they do not exist in the
text, are stopwords, or are shorter than the minimum length
of indexed words.
</p>
</li>
</ul>
</div>
<p>
The following examples demonstrate some search strings that use
boolean full-text operators:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
'apple banana'
</code>
</p>
<p>
Find rows that contain at least one of the two words.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'+apple +juice'
</code>
</p>
<p>
Find rows that contain both words.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'+apple macintosh'
</code>
</p>
<p>
Find rows that contain the word
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
, but
rank rows higher if they also contain
<span class="quote">
“
<span class="quote">
macintosh
</span>
”
</span>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'+apple -macintosh'
</code>
</p>
<p>
Find rows that contain the word
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
but not
<span class="quote">
“
<span class="quote">
macintosh
</span>
”
</span>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'+apple ~macintosh'
</code>
</p>
<p>
Find rows that contain the word
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
, but if
the row also contains the word
<span class="quote">
“
<span class="quote">
macintosh
</span>
”
</span>
,
rate it lower than if row does not. This is
<span class="quote">
“
<span class="quote">
softer
</span>
”
</span>
than a search for
<code class="literal">
'+apple
-macintosh'
</code>
, for which the presence of
<span class="quote">
“
<span class="quote">
macintosh
</span>
”
</span>
causes the row not to be returned
at all.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'+apple +(>turnover <strudel)'
</code>
</p>
<p>
Find rows that contain the words
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
turnover
</span>
”
</span>
, or
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
strudel
</span>
”
</span>
(in any order), but rank
<span class="quote">
“
<span class="quote">
apple
turnover
</span>
”
</span>
higher than
<span class="quote">
“
<span class="quote">
apple strudel
</span>
”
</span>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'apple*'
</code>
</p>
<p>
Find rows that contain words such as
<span class="quote">
“
<span class="quote">
apple
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
apples
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
applesauce
</span>
”
</span>
, or
<span class="quote">
“
<span class="quote">
applet
</span>
”
</span>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
'"some words"'
</code>
</p>
<p>
Find rows that contain the exact phrase
<span class="quote">
“
<span class="quote">
some
words
</span>
”
</span>
(for example, rows that contain
<span class="quote">
“
<span class="quote">
some
words of wisdom
</span>
”
</span>
but not
<span class="quote">
“
<span class="quote">
some noise
words
</span>
”
</span>
). Note that the
<code class="literal">
"
</code>
characters that enclose the phrase are operator characters
that delimit the phrase. They are not the quotation marks
that enclose the search string itself.
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-boolean-innodb-relevancy-ranking">
</a>
Relevancy Rankings for InnoDB Boolean Mode Search
</h4>
</div>
</div>
</div>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
full-text search is
modeled on the
<a class="ulink" href="http://sphinxsearch.com/" target="_blank">
Sphinx
</a>
full-text
search engine, and the algorithms used are based on
<a class="ulink" href="http://en.wikipedia.org/wiki/Okapi_BM25" target="_blank">
BM25
</a>
and
<a class="ulink" href="http://en.wikipedia.org/wiki/TF-IDF" target="_blank">
TF-IDF
</a>
ranking algorithms. For these reasons, relevancy rankings for
<code class="literal">
InnoDB
</code>
boolean full-text search may differ
from
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
relevancy rankings.
</p>
<p>
<code class="literal">
InnoDB
</code>
uses a variation of the
<span class="quote">
“
<span class="quote">
term
frequency-inverse document frequency
</span>
”
</span>
(
<code class="literal">
TF-IDF
</code>
) weighting system to rank a
document's relevance for a given full-text search query. The
<code class="literal">
TF-IDF
</code>
weighting is based on how frequently
a word appears in a document, offset by how frequently the
word appears in all documents in the collection. In other
words, the more frequently a word appears in a document, and
the less frequently the word appears in the document
collection, the higher the document is ranked.
</p>
<h5>
<a name="idm46045201678384">
</a>
How Relevancy Ranking is Calculated
</h5>
<p>
The term frequency (
<code class="literal">
TF
</code>
) value is the number
of times that a word appears in a document. The inverse
document frequency (
<code class="literal">
IDF
</code>
) value of a word is
calculated using the following formula, where
<code class="literal">
total_records
</code>
is the number of records in
the collection, and
<code class="literal">
matching_records
</code>
is the
number of records that the search term appears in.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa33355922"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">=</span> log10<span class="token punctuation">(</span> $<span class="token punctuation">{</span>total_records<span class="token punctuation">}</span> <span class="token operator">/</span> $<span class="token punctuation">{</span>matching_records<span class="token punctuation">}</span> <span class="token punctuation">)</span></code></pre>
</div>
<p>
When a document contains a word multiple times, the IDF value
is multiplied by the TF value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa62291994"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
</div>
<p>
Using the
<code class="literal">
TF
</code>
and
<code class="literal">
IDF
</code>
values, the relevancy ranking for a document is calculated
using this formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa12196992"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
</div>
<p>
The formula is demonstrated in the following examples.
</p>
<h5>
<a name="idm46045201668208">
</a>
Relevancy Ranking for a Single Word Search
</h5>
<p>
This example demonstrates the relevancy ranking calculation
for a single-word search.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52177525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> articles <span class="token punctuation">(</span>
<span class="token prompt"> -></span> id <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> title <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> body <span class="token datatype">TEXT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">FULLTEXT</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token prompt"> -></span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.04 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> articles <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span> <span class="token keyword">VALUES</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'MySQL Tutorial'</span><span class="token punctuation">,</span><span class="token string">'This database tutorial ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">"How To Use MySQL"</span><span class="token punctuation">,</span><span class="token string">'After you went through a ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'Optimizing Your Database'</span><span class="token punctuation">,</span><span class="token string">'In this database tutorial ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'MySQL vs. YourSQL'</span><span class="token punctuation">,</span><span class="token string">'When comparing databases ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'MySQL Security'</span><span class="token punctuation">,</span><span class="token string">'When configured properly, MySQL ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'Database, Database, Database'</span><span class="token punctuation">,</span><span class="token string">'database database database'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'1001 MySQL Tricks'</span><span class="token punctuation">,</span><span class="token string">'1. Never run mysqld as root. 2. ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'MySQL Full-Text Indexes'</span><span class="token punctuation">,</span> <span class="token string">'MySQL fulltext indexes use a ..'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 8 rows affected (0.06 sec)</span>
<span class="token output">Records: 8 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> title<span class="token punctuation">,</span> body<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span> <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'database'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> score
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> articles <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> score <span class="token keyword">DESC</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> title <span class="token punctuation">|</span> body <span class="token punctuation">|</span> score <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> Database, Database, Database <span class="token punctuation">|</span> database database database <span class="token punctuation">|</span> 1.0886961221694946 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> Optimizing Your Database <span class="token punctuation">|</span> In this database tutorial ... <span class="token punctuation">|</span> 0.36289870738983154 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> MySQL Tutorial <span class="token punctuation">|</span> This database tutorial ... <span class="token punctuation">|</span> 0.18144935369491577 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> How To Use MySQL <span class="token punctuation">|</span> After you went through a ... <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> MySQL vs. YourSQL <span class="token punctuation">|</span> When comparing databases ... <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> MySQL Security <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 1001 MySQL Tricks <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> MySQL Full<span class="token punctuation">-</span>Text Indexes <span class="token punctuation">|</span> MySQL fulltext indexes use a .. <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">8 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
There are 8 records in total, with 3 that match the
<span class="quote">
“
<span class="quote">
database
</span>
”
</span>
search term. The first record
(
<code class="literal">
id 6
</code>
) contains the search term 6 times and
has a relevancy ranking of
<code class="literal">
1.0886961221694946
</code>
. This ranking value is
calculated using a
<code class="literal">
TF
</code>
value of 6 (the
<span class="quote">
“
<span class="quote">
database
</span>
”
</span>
search term appears 6 times in record
<code class="literal">
id 6
</code>
) and an
<code class="literal">
IDF
</code>
value
of 0.42596873216370745, which is calculated as follows (where
8 is the total number of records and 3 is the number of
records that the search term appears in):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa28453778"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">=</span> LOG10<span class="token punctuation">(</span> 8 <span class="token operator">/</span> 3 <span class="token punctuation">)</span> <span class="token operator">=</span> 0<span class="token punctuation">.</span>42596873216370745</code></pre>
</div>
<p>
The
<code class="literal">
TF
</code>
and
<code class="literal">
IDF
</code>
values
are then entered into the ranking formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa52453593"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
</div>
<p>
Performing the calculation in the MySQL command-line client
returns a ranking value of 1.088696164686938.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20759166"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">6</span><span class="token operator">*</span><span class="token function">LOG10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">LOG10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6*LOG10(8/3)*LOG10(8/3) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1.088696164686938 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You may notice a slight difference in the ranking values
returned by the
<code class="literal">
SELECT ... MATCH ...
AGAINST
</code>
statement and the MySQL command-line
client (
<code class="literal">
1.0886961221694946
</code>
versus
<code class="literal">
1.088696164686938
</code>
). The difference is due
to how the casts between integers and floats/doubles are
performed internally by
<code class="literal">
InnoDB
</code>
(along
with related precision and rounding decisions), and how they
are performed elsewhere, such as in the MySQL command-line
client or other types of calculators.
</p>
</div>
<h5>
<a name="idm46045201635600">
</a>
Relevancy Ranking for a Multiple Word Search
</h5>
<p>
This example demonstrates the relevancy ranking calculation
for a multiple-word full-text search based on the
<code class="literal">
articles
</code>
table and data used in the
previous example.
</p>
<p>
If you search on more than one word, the relevancy ranking
value is a sum of the relevancy ranking value for each word,
as shown in this formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa89555483"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">+</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
</div>
<p>
Performing a search on two terms ('mysql tutorial') returns
the following results:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93739978"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> title<span class="token punctuation">,</span> body<span class="token punctuation">,</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'mysql tutorial'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> score
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> articles <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> score <span class="token keyword">DESC</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> title <span class="token punctuation">|</span> body <span class="token punctuation">|</span> score <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> MySQL Tutorial <span class="token punctuation">|</span> This database tutorial ... <span class="token punctuation">|</span> 0.7405621409416199 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> Optimizing Your Database <span class="token punctuation">|</span> In this database tutorial ... <span class="token punctuation">|</span> 0.3624762296676636 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> MySQL Security <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span> 0.031219376251101494 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> MySQL Full<span class="token punctuation">-</span>Text Indexes <span class="token punctuation">|</span> MySQL fulltext indexes use a .. <span class="token punctuation">|</span> 0.031219376251101494 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> How To Use MySQL <span class="token punctuation">|</span> After you went through a ... <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> MySQL vs. YourSQL <span class="token punctuation">|</span> When comparing databases ... <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 1001 MySQL Tricks <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> Database, Database, Database <span class="token punctuation">|</span> database database database <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">8 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
In the first record (
<code class="literal">
id 8
</code>
), 'mysql' appears
once and 'tutorial' appears twice. There are six matching
records for 'mysql' and two matching records for 'tutorial'.
The MySQL command-line client returns the expected ranking
value when inserting these values into the ranking formula for
a multiple word search:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18617036"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> (1*log10(8/6)*log10(8/6)) <span class="token punctuation">+</span> (2*log10(8/2)*log10(8/2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0.7405621541938003 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The slight difference in the ranking values returned by the
<code class="literal">
SELECT ... MATCH ... AGAINST
</code>
statement
and the MySQL command-line client is explained in the
preceding example.
</p>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-blocks.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-blocks">
</a>
25.6.17.5 The ndbinfo blocks Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045090455968">
</a>
<p>
The
<code class="literal">
blocks
</code>
table is a static table which
simply contains the names and internal IDs of all NDB kernel
blocks (see
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks.html" target="_top">
NDB Kernel Blocks
</a>
). It
is for use by the other
<a class="link" href="mysql-cluster-ndbinfo.html" title="25.6.17 ndbinfo: The NDB Cluster Information Database">
<code class="literal">
ndbinfo
</code>
</a>
tables (most of which
are actually views) in mapping block numbers to block names for
producing human-readable output.
</p>
<p>
The
<code class="literal">
blocks
</code>
table contains the following
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
block_number
</code>
</p>
<p>
Block number
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
block_name
</code>
</p>
<p>
Block name
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045090445728">
</a>
Notes
</h5>
<p>
To obtain a list of all block names, simply execute
<code class="literal">
SELECT block_name FROM ndbinfo.blocks
</code>
.
Although this is a static table, its content can vary between
different NDB Cluster releases.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-schemata-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-schemata-table">
</a>
28.3.31 The INFORMATION_SCHEMA SCHEMATA Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045078775792">
</a>
<p>
A schema is a database, so the
<a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
<code class="literal">
SCHEMATA
</code>
</a>
table provides information
about databases.
</p>
<p>
The
<a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
<code class="literal">
SCHEMATA
</code>
</a>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
CATALOG_NAME
</code>
</p>
<p>
The name of the catalog to which the schema belongs. This
value is always
<code class="literal">
def
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SCHEMA_NAME
</code>
</p>
<p>
The name of the schema.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFAULT_CHARACTER_SET_NAME
</code>
</p>
<p>
The schema default character set.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFAULT_COLLATION_NAME
</code>
</p>
<p>
The schema default collation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SQL_PATH
</code>
</p>
<p>
This value is always
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFAULT_ENCRYPTION
</code>
</p>
<p>
The schema default encryption.
</p>
</li>
</ul>
</div>
<p>
Schema names are also available from the
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW
DATABASES
</code>
</a>
statement. See
<a class="xref" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
Section 15.7.7.15, “SHOW DATABASES Statement”
</a>
. The following statements are
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66576438"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token keyword">SCHEMA_NAME</span> <span class="token keyword">AS</span> <span class="token punctuation">`</span><span class="token keyword">Database</span><span class="token punctuation">`</span>
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>SCHEMATA
<span class="token punctuation">[</span><span class="token keyword">WHERE</span> <span class="token keyword">SCHEMA_NAME</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">SHOW</span> <span class="token keyword">DATABASES</span>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
You see only those databases for which you have some kind of
privilege, unless you have the global
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW
DATABASES
</code>
</a>
privilege.
</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Caution
</div>
<p>
Because any static global privilege is considered a privilege
for all databases, any static global privilege enables a user to
see all database names with
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW
DATABASES
</code>
</a>
or by examining the
<a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
<code class="literal">
SCHEMATA
</code>
</a>
table of
<code class="literal">
INFORMATION_SCHEMA
</code>
, except databases that
have been restricted at the database level by partial revokes.
</p>
</div>
<h4>
<a name="idm46045078747248">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="information-schema-schemata-extensions-table.html" title="28.3.32 The INFORMATION_SCHEMA SCHEMATA_EXTENSIONS Table">
<code class="literal">
SCHEMATA_EXTENSIONS
</code>
</a>
table
augments the
<a class="link" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
<code class="literal">
SCHEMATA
</code>
</a>
table with
information about schema options.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-memory-by-host-by-current-bytes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-memory-by-host-by-current-bytes">
</a>
30.4.3.16 The memory_by_host_by_current_bytes and
x$memory_by_host_by_current_bytes Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062873168">
</a>
<a class="indexterm" name="idm46045062871712">
</a>
<a class="indexterm" name="idm46045062870208">
</a>
<a class="indexterm" name="idm46045062868704">
</a>
<p>
These views summarize memory use, grouped by host. By default,
rows are sorted by descending amount of memory used.
</p>
<p>
The
<a class="link" href="sys-memory-by-host-by-current-bytes.html" title="30.4.3.16 The memory_by_host_by_current_bytes and x$memory_by_host_by_current_bytes Views">
<code class="literal">
memory_by_host_by_current_bytes
</code>
</a>
and
<a class="link" href="sys-memory-by-host-by-current-bytes.html" title="30.4.3.16 The memory_by_host_by_current_bytes and x$memory_by_host_by_current_bytes Views">
<code class="literal">
x$memory_by_host_by_current_bytes
</code>
</a>
views have these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
host
</code>
</p>
<p>
The host from which the client connected. Rows for which
the
<code class="literal">
HOST
</code>
column in the underlying
Performance Schema table is
<code class="literal">
NULL
</code>
are
assumed to be for background threads and are reported with
a host name of
<code class="literal">
background
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_count_used
</code>
</p>
<p>
The current number of allocated memory blocks that have
not been freed yet for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_allocated
</code>
</p>
<p>
The current number of allocated bytes that have not been
freed yet for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_avg_alloc
</code>
</p>
<p>
The current number of allocated bytes per memory block for
the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_max_alloc
</code>
</p>
<p>
The largest single current memory allocation in bytes for
the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_allocated
</code>
</p>
<p>
The total memory allocation in bytes for the host.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisamchk-general-options.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="myisamchk-general-options">
</a>
6.6.4.1 myisamchk General Options
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045307534656">
</a>
<a class="indexterm" name="idm46045307533168">
</a>
<p>
The options described in this section can be used for any type
of table maintenance operation performed by
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
. The sections following this one
describe options that pertain only to specific operations, such
as table checking or repairing.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_myisamchk_help">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_help">
<code class="option">
--help
</code>
</a>
,
<code class="option">
-?
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for help">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--help
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307521664">
</a>
<a class="indexterm" name="idm46045307520176">
</a>
<p>
Display a help message and exit. Options are grouped by type
of operation.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_HELP">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_HELP">
<code class="option">
--HELP
</code>
</a>
,
<code class="option">
-H
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for HELP">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--HELP
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307510128">
</a>
<a class="indexterm" name="idm46045307508640">
</a>
<p>
Display a help message and exit. Options are presented in a
single list.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_debug">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_debug">
<code class="option">
--debug=
<em class="replaceable">
<code>
debug_options
</code>
</em>
</code>
</a>
,
<code class="option">
-#
<em class="replaceable">
<code>
debug_options
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug[=debug_options]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
d:t:o,/tmp/myisamchk.trace
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307493568">
</a>
<a class="indexterm" name="idm46045307492080">
</a>
<p>
Write a debugging log. A typical
<em class="replaceable">
<code>
debug_options
</code>
</em>
string is
<code class="literal">
d:t:o,
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
.
The default is
<code class="literal">
d:t:o,/tmp/myisamchk.trace
</code>
.
</p>
<p>
This option is available only if MySQL was built using
<a class="link" href="source-configuration-options.html#option_cmake_with_debug">
<code class="option">
WITH_DEBUG
</code>
</a>
. MySQL release
binaries provided by Oracle are
<span class="emphasis">
<em>
not
</em>
</span>
built using this option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_defaults-extra-file">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_defaults-extra-file">
<code class="option">
--defaults-extra-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307475904">
</a>
<a class="indexterm" name="idm46045307474400">
</a>
<p>
Read this option file after the global option file but (on
Unix) before the user option file. If the file does not
exist or is otherwise inaccessible, an error occurs. If
<em class="replaceable">
<code>
file_name
</code>
</em>
is not an absolute path
name, it is interpreted relative to the current directory.
</p>
<p>
For additional information about this and other option-file
options, see
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_defaults-file">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_defaults-file">
<code class="option">
--defaults-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307460560">
</a>
<a class="indexterm" name="idm46045307459072">
</a>
<p>
Use only the given option file. If the file does not exist
or is otherwise inaccessible, an error occurs. If
<em class="replaceable">
<code>
file_name
</code>
</em>
is not an absolute path
name, it is interpreted relative to the current directory.
</p>
<p>
For additional information about this and other option-file
options, see
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_defaults-group-suffix">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=
<em class="replaceable">
<code>
str
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=str
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307445280">
</a>
<a class="indexterm" name="idm46045307443776">
</a>
<p>
Read not only the usual option groups, but also groups with
the usual names and a suffix of
<em class="replaceable">
<code>
str
</code>
</em>
. For example,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
normally reads the
<code class="literal">
[myisamchk]
</code>
group. If this option is
given as
<a class="link" href="myisamchk-general-options.html#option_myisamchk_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=_other
</code>
</a>
,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
also reads the
<code class="literal">
[myisamchk_other]
</code>
group.
</p>
<p>
For additional information about this and other option-file
options, see
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_no-defaults">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307427440">
</a>
<a class="indexterm" name="idm46045307425952">
</a>
<p>
Do not read any option files. If program startup fails due
to reading unknown options from an option file,
<a class="link" href="myisamchk-general-options.html#option_myisamchk_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
can be used
to prevent them from being read.
</p>
<p>
The exception is that the
<code class="filename">
.mylogin.cnf
</code>
file is read in all cases, if it exists. This permits
passwords to be specified in a safer way than on the command
line even when
<a class="link" href="myisamchk-general-options.html#option_myisamchk_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
is used. To
create
<code class="filename">
.mylogin.cnf
</code>
, use the
<a class="link" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
<span class="command">
<strong>
mysql_config_editor
</strong>
</span>
</a>
utility. See
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
.
</p>
<p>
For additional information about this and other option-file
options, see
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_print-defaults">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307409104">
</a>
<a class="indexterm" name="idm46045307407616">
</a>
<p>
Print the program name and all options that it gets from
option files.
</p>
<p>
For additional information about this and other option-file
options, see
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_silent">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_silent">
<code class="option">
--silent
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for silent">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--silent
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307396464">
</a>
<a class="indexterm" name="idm46045307394976">
</a>
<p>
Silent mode. Write output only when errors occur. You can
use
<code class="option">
-s
</code>
twice (
<code class="option">
-ss
</code>
) to make
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
very silent.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_verbose">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_verbose">
<code class="option">
--verbose
</code>
</a>
,
<code class="option">
-v
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for verbose">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--verbose
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307382720">
</a>
<a class="indexterm" name="idm46045307381232">
</a>
<p>
Verbose mode. Print more information about what the program
does. This can be used with
<code class="option">
-d
</code>
and
<code class="option">
-e
</code>
. Use
<code class="option">
-v
</code>
multiple times
(
<code class="option">
-vv
</code>
,
<code class="option">
-vvv
</code>
) for even more
output.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_version">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_version">
<code class="option">
--version
</code>
</a>
,
<code class="option">
-V
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307368992">
</a>
<a class="indexterm" name="idm46045307367504">
</a>
<p>
Display version information and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_wait">
</a>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_wait">
<code class="option">
--wait
</code>
</a>
,
<code class="option">
-w
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for wait">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--wait
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
false
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307353056">
</a>
<a class="indexterm" name="idm46045307351568">
</a>
<p>
Instead of terminating with an error if the table is locked,
wait until the table is unlocked before continuing. If you
are running
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with external locking
disabled, the table can be locked only by another
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
command.
</p>
</li>
</ul>
</div>
<p>
You can also set the following variables by using
<code class="option">
--
<em class="replaceable">
<code>
var_name
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
syntax:
</p>
<a class="indexterm" name="idm46045307345120">
</a>
<a class="indexterm" name="idm46045307344032">
</a>
<a class="indexterm" name="idm46045307342944">
</a>
<a class="indexterm" name="idm46045307341856">
</a>
<a class="indexterm" name="idm46045307340768">
</a>
<a class="indexterm" name="idm46045307339680">
</a>
<a class="indexterm" name="idm46045307338592">
</a>
<a class="indexterm" name="idm46045307337504">
</a>
<a class="indexterm" name="idm46045307336416">
</a>
<a class="indexterm" name="idm46045307335312">
</a>
<a class="indexterm" name="idm46045307334224">
</a>
<a class="indexterm" name="idm46045307333136">
</a>
<div class="informaltable">
<table summary="myisamchk variables that can be set using --var_name=value syntax. The table also provides the default value for each variable.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 35%"/>
</colgroup>
<thead>
<tr>
<th>
Variable
</th>
<th>
Default Value
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
decode_bits
</code>
</td>
<td>
9
</td>
</tr>
<tr>
<td>
<code class="literal">
ft_max_word_len
</code>
</td>
<td>
version-dependent
</td>
</tr>
<tr>
<td>
<code class="literal">
ft_min_word_len
</code>
</td>
<td>
4
</td>
</tr>
<tr>
<td>
<code class="literal">
ft_stopword_file
</code>
</td>
<td>
built-in list
</td>
</tr>
<tr>
<td>
<code class="literal">
key_buffer_size
</code>
</td>
<td>
523264
</td>
</tr>
<tr>
<td>
<code class="literal">
myisam_block_size
</code>
</td>
<td>
1024
</td>
</tr>
<tr>
<td>
<code class="literal">
myisam_sort_key_blocks
</code>
</td>
<td>
16
</td>
</tr>
<tr>
<td>
<code class="literal">
read_buffer_size
</code>
</td>
<td>
262136
</td>
</tr>
<tr>
<td>
<code class="literal">
sort_buffer_size
</code>
</td>
<td>
2097144
</td>
</tr>
<tr>
<td>
<code class="literal">
sort_key_blocks
</code>
</td>
<td>
16
</td>
</tr>
<tr>
<td>
<code class="literal">
stats_method
</code>
</td>
<td>
nulls_unequal
</td>
</tr>
<tr>
<td>
<code class="literal">
write_buffer_size
</code>
</td>
<td>
262136
</td>
</tr>
</tbody>
</table>
</div>
<div class="informaltable">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 532px;">
<thead>
<tr>
<th style="width: 265.375px;">
Variable
</th>
<th style="width: 265.375px;">
Default Value
</th>
</tr>
</thead>
</table>
</div>
<p>
The possible
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
variables and their
default values can be examined with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
--help
</strong>
</span>
</a>
:
</p>
<p>
<code class="literal">
myisam_sort_buffer_size
</code>
is used when the keys
are repaired by sorting keys, which is the normal case when you
use
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
.
<code class="literal">
sort_buffer_size
</code>
is a deprecated synonym for
<code class="literal">
myisam_sort_buffer_size
</code>
.
</p>
<p>
<code class="literal">
key_buffer_size
</code>
is used when you are checking
the table with
<a class="link" href="myisamchk-check-options.html#option_myisamchk_extend-check">
<code class="option">
--extend-check
</code>
</a>
or when the keys are repaired by inserting keys row by row into
the table (like when doing normal inserts). Repairing through
the key buffer is used in the following cases:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You use
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
<code class="option">
--safe-recover
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
The temporary files needed to sort the keys would be more
than twice as big as when creating the key file directly.
This is often the case when you have large key values for
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns, because the
sort operation needs to store the complete key values as it
proceeds. If you have lots of temporary space and you can
force
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to repair by sorting, you
can use the
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_sort-recover">
<code class="option">
--sort-recover
</code>
</a>
option.
</p>
</li>
</ul>
</div>
<p>
Repairing through the key buffer takes much less disk space than
using sorting, but is also much slower.
</p>
<p>
If you want a faster repair, set the
<code class="literal">
key_buffer_size
</code>
and
<code class="literal">
myisam_sort_buffer_size
</code>
variables to about
25% of your available memory. You can set both variables to
large values, because only one of them is used at a time.
</p>
<p>
<code class="literal">
myisam_block_size
</code>
is the size used for index
blocks.
</p>
<p>
<code class="literal">
stats_method
</code>
influences how
<code class="literal">
NULL
</code>
values are treated for index statistics
collection when the
<a class="link" href="myisamchk-other-options.html#option_myisamchk_analyze">
<code class="option">
--analyze
</code>
</a>
option is given. It acts like the
<code class="literal">
myisam_stats_method
</code>
system variable. For more
information, see the description of
<code class="literal">
myisam_stats_method
</code>
in
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
, and
<a class="xref" href="index-statistics.html" title="10.3.8 InnoDB and MyISAM Index Statistics Collection">
Section 10.3.8, “InnoDB and MyISAM Index Statistics Collection”
</a>
.
</p>
<p>
<code class="literal">
ft_min_word_len
</code>
and
<code class="literal">
ft_max_word_len
</code>
indicate the minimum and
maximum word length for
<code class="literal">
FULLTEXT
</code>
indexes on
<code class="literal">
MyISAM
</code>
tables.
<code class="literal">
ft_stopword_file
</code>
names the stopword file.
These need to be set under the following circumstances.
</p>
<p>
If you use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to perform an operation
that modifies table indexes (such as repair or analyze), the
<code class="literal">
FULLTEXT
</code>
indexes are rebuilt using the
default full-text parameter values for minimum and maximum word
length and the stopword file unless you specify otherwise. This
can result in queries failing.
</p>
<p>
The problem occurs because these parameters are known only by
the server. They are not stored in
<code class="literal">
MyISAM
</code>
index files. To avoid the problem if you have modified the
minimum or maximum word length or the stopword file in the
server, specify the same
<code class="literal">
ft_min_word_len
</code>
,
<code class="literal">
ft_max_word_len
</code>
, and
<code class="literal">
ft_stopword_file
</code>
values to
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
that you use for
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. For example, if you have set the
minimum word length to 3, you can repair a table with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa12542802"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">myisamchk <span class="token property">--recover</span> <span class="token constant">--ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <em class="replaceable">tbl_name</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
To ensure that
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
and the server use
the same values for full-text parameters, you can place each one
in both the
<code class="literal">
[mysqld]
</code>
and
<code class="literal">
[myisamchk]
</code>
sections of an option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa49066124"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span>
<span class="token selector">[myisamchk]</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span></code></pre>
</div>
<p>
An alternative to using
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
is to use
the
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
,
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
,
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
, or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
. These statements are
performed by the server, which knows the proper full-text
parameter values to use.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/making-windows-dumps.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="making-windows-dumps">
</a>
7.9.1.3 Using WER with PDB to create a Windows crashdump
</h4>
</div>
</div>
</div>
<p>
Program Database files (with suffix
<code class="filename">
pdb
</code>
)
are included in the
<span class="bold">
<strong>
ZIP Archive Debug
Binaries & Test Suite
</strong>
</span>
distribution of MySQL.
These files provide information for debugging your MySQL
installation in the event of a problem. This is a separate
download from the standard MSI or Zip file.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The PDB files are available in a separate file labeled "ZIP
Archive Debug Binaries & Test Suite".
</p>
</div>
<p>
The PDB file contains more detailed information about
<code class="literal">
mysqld
</code>
and other tools that enables more
detailed trace and dump files to be created. You can use these
with
<span class="command">
<strong>
WinDbg
</strong>
</span>
or Visual Studio to debug
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
<p>
For more information on PDB files and the debugging options
available, see
<a class="ulink" href="https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/" target="_blank">
Debugging
Tools for Windows
</a>
.
</p>
<p>
To use WinDbg, either install the full Windows Driver Kit (WDK)
or install the standalone version.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The
<code class="filename">
.exe
</code>
and
<code class="filename">
.pdb
</code>
files must be an exact match (both version number and MySQL
server edition); otherwise, or WinDBG complains while
attempting to load the symbols.
</p>
</div>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
To generate a minidump
<code class="filename">
mysqld.dmp
</code>
,
enable the
<a class="link" href="server-options.html#option_mysqld_core-file">
<code class="option">
core-file
</code>
</a>
option
under the [mysqld] section in
<code class="filename">
my.ini
</code>
.
Restart the MySQL server after making these changes.
</p>
</li>
<li class="listitem">
<p>
Create a directory to store the generated files, such as
<code class="filename">
c:\symbols
</code>
</p>
</li>
<li class="listitem">
<p>
Determine the path to your
<span class="command">
<strong>
windbg.exe
</strong>
</span>
executable using the Find GUI or from the command line, for
example:
<code class="literal">
dir /s /b windbg.exe
</code>
-- a common
default is
<span class="emphasis">
<em>
C:\Program Files\Debugging Tools for
Windows (x64)\windbg.exe
</em>
</span>
</p>
</li>
<li class="listitem">
<p>
Launch
<code class="filename">
windbg.exe
</code>
giving it the paths
to
<code class="filename">
mysqld.exe
</code>
,
<code class="filename">
mysqld.pdb
</code>
,
<code class="filename">
mysqld.dmp
</code>
, and the source code.
Alternatively, pass in each path from the WinDbg GUI. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa55036389"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">windbg<span class="token punctuation">.</span>exe <span class="token property">-i</span> "C<span class="token punctuation">:</span>\mysql-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3-winx64\bin\"^
<span class="token property">-z</span> <span class="token atrule">"C:\mysql-8.4.3-winx64\data\mysqld.dmp"</span>^
<span class="token property">-srcpath</span> <span class="token atrule">"E:\ade\mysql_archives\8.4\8.4.3\mysql-8.4.3"</span>^
<span class="token property">-y</span> <span class="token atrule">"C:\mysql-8.4.3-winx64\bin;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols"</span>^
<span class="token property">-v</span> <span class="token property">-n</span> <span class="token property">-c</span> <span class="token atrule">"!analyze -vvvvv"</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
^
</code>
character and newline are removed
by the Windows command line processor, so be sure the
spaces remain intact.
</p>
</div>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/too-many-connections.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="too-many-connections">
</a>
B.3.2.5 Too many connections
</h4>
</div>
</div>
</div>
<p>
If clients encounter
<code class="literal">
Too many connections
</code>
errors when attempting to connect to the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server, all available connections
are in use by other clients.
</p>
<p>
The permitted number of connections is controlled by the
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
system
variable. To support more connections, set
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
to a larger
value.
</p>
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
actually permits
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
+ 1 client connections. The extra connection is reserved for
use by accounts that have the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privilege (or
the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege). By granting the privilege to administrators and
not to normal users (who should not need it), an administrator
can connect to the server and use
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
to diagnose problems even if the maximum
number of unprivileged clients are connected. See
<a class="xref" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
Section 15.7.7.31, “SHOW PROCESSLIST Statement”
</a>
.
</p>
<p>
The server also permits administrative connections on a
dedicated interface. For more information about how the server
handles client connections, see
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-news.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-cluster-news">
</a>
25.8 NDB Cluster Release Notes
</h2>
</div>
</div>
</div>
<p>
Changes in NDB Cluster releases are documented separately from
this reference manual; you can find release notes for NDB Cluster
8.4
<a class="ulink" href="/doc/relnotes/mysql-cluster/8.4/en/" target="_top">
NDB 8.4
Release Notes
</a>
.
</p>
<p>
You can obtain release notes for older versions of NDB Cluster
from
<a class="ulink" href="/doc/index-cluster.html#cluster-relnotes" target="_top">
NDB
Cluster Release Notes
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/trace-general-structure.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="trace-general-structure">
</a>
10.15.11 Trace General Structure
</h3>
</div>
</div>
</div>
<p>
A trace follows the actual execution path very closely; for each
join, there is a join preparation object, a join optimization
object, and a join execution object. Query transformations
(
<code class="literal">
IN
</code>
to
<code class="literal">
EXISTS
</code>
, outer join to
inner join, and so on), simplifications (elimination of clauses),
and equality propagation are shown in subobjects. Calls to the
range optimizer, cost evaluations, reasons why an access path is
chosen over another one, or why a sorting method is chosen over
another one, are shown as well.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/out-of-memory.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="out-of-memory">
</a>
B.3.2.6 Out of memory
</h4>
</div>
</div>
</div>
<p>
If you issue a query using the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client
program and receive an error like the following one, it means
that
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
does not have enough memory to
store the entire query result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa44193914"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">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</code></pre>
</div>
<p>
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
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
with the
<a class="link" href="mysql-command-options.html#option_mysql_quick">
<code class="option">
--quick
</code>
</a>
option. This causes it
to use the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-use-result.html" target="_top">
<code class="literal">
mysql_use_result()
</code>
</a>
C API function to retrieve the result set, which places less
of a load on the client (but more on the server).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-remote.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-remote">
</a>
7.6.7.3 Cloning Remote Data
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255640512">
</a>
<p>
The clone plugin supports the following syntax for cloning
remote data; that is, cloning data from a remote MySQL server
instance (the donor) and transferring it to the MySQL instance
where the cloning operation was initiated (the recipient).
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15705624"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">host</em>'</span>:<span class="token keyword"><em class="replaceable">port</em></span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token string">'<em class="replaceable">clone_dir</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">REQUIRE</span> <span class="token punctuation">[</span><span class="token keyword">NO</span><span class="token punctuation">]</span> <span class="token keyword">SSL</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
where:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
user
</code>
</em>
</code>
is the
clone user on the donor MySQL server instance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
password
</code>
</em>
</code>
is
the
<code class="literal">
<em class="replaceable">
<code>
user
</code>
</em>
</code>
password.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
host
</code>
</em>
</code>
is the
<a class="link" href="server-system-variables.html#sysvar_hostname">
<code class="literal">
hostname
</code>
</a>
address of the
donor MySQL server instance. Internet Protocol version 6
(IPv6) address format is not supported. An alias to the IPv6
address can be used instead. An IPv4 address can be used as
is.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
port
</code>
</em>
</code>
is the
<a class="link" href="server-system-variables.html#sysvar_port">
<code class="literal">
port
</code>
</a>
number of the donor
MySQL server instance. (The X Protocol port specified by
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_port">
<code class="literal">
mysqlx_port
</code>
</a>
is not
supported. Connecting to the donor MySQL server instance
through MySQL Router is also not supported.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
is an
optional clause used to specify a directory on the recipient
for the data you are cloning. Use this option if you do not
want to remove existing user-created data (schemas, tables,
tablespaces) and binary logs from the recipient data
directory. An absolute path is required, and the directory
must not exist. The MySQL server must have the necessary
write access to create the directory.
</p>
<p>
When the optional
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
clause is
not used, a cloning operation removes user-created data
(schemas, tables, tablespaces) and binary logs from the
recipient data directory, clones the new data to the
recipient data directory, and automatically restarts the
server afterward.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
[REQUIRE [NO] SSL]
</code>
explicitly specifies
whether an encrypted connection is to be used or not when
transferring cloned data over the network. An error is
returned if the explicit specification cannot be satisfied.
If an SSL clause is not specified, clone attempts to
establish an encrypted connection by default, falling back
to an insecure connection if the secure connection attempt
fails. A secure connection is required when cloning
encrypted data regardless of whether this clause is
specified. For more information, see
<a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
Configuring an Encrypted Connection for Cloning
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
By default, user-created
<code class="literal">
InnoDB
</code>
tables and
tablespaces that reside in the data directory on the donor
MySQL server instance are cloned to the data directory on the
recipient MySQL server instance. If the
<code class="literal">
DATA
DIRECTORY [=] '
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
clause is specified, they are cloned to the specified
directory.
</p>
<p>
User-created
<code class="literal">
InnoDB
</code>
tables and tablespaces
that reside outside of the data directory on the donor MySQL
server instance are cloned to the same path on the recipient
MySQL server instance. An error is reported if a table or
tablespace already exists.
</p>
<p>
By default, the
<code class="literal">
InnoDB
</code>
system tablespace,
redo logs, and undo tablespaces are cloned to the same
locations that are configured on the donor (as defined by
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
<code class="literal">
innodb_log_group_home_dir
</code>
</a>
,
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
,
respectively). If the
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
clause is
specified, those tablespaces and logs are cloned to the
specified directory.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="clone-remote-prerequisites">
</a>
Remote Cloning Prerequisites
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255602464">
</a>
<p>
To perform a cloning operation, the clone plugin must be
active on both the donor and recipient MySQL server instances.
For installation instructions, see
<a class="xref" href="clone-plugin-installation.html" title="7.6.7.1 Installing the Clone Plugin">
Section 7.6.7.1, “Installing the Clone Plugin”
</a>
.
</p>
<p>
A MySQL user on the donor and recipient is required for
executing the cloning operation (the
<span class="quote">
“
<span class="quote">
clone
user
</span>
”
</span>
).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On the donor, the clone user requires the
<a class="link" href="privileges-provided.html#priv_backup-admin">
<code class="literal">
BACKUP_ADMIN
</code>
</a>
privilege for
accessing and transferring data from the donor and
blocking concurrent DDL during the cloning operation.
Concurrent DDL is permitted on the donor by default. See
<a class="xref" href="clone-plugin-concurrent-ddl.html" title="7.6.7.4 Cloning and Concurrent DDL">
Section 7.6.7.4, “Cloning and Concurrent DDL”
</a>
.
</p>
</li>
<li class="listitem">
<p>
On the recipient, the clone user requires the
<a class="link" href="privileges-provided.html#priv_clone-admin">
<code class="literal">
CLONE_ADMIN
</code>
</a>
privilege for
replacing recipient data, blocking DDL on the recipient
during the cloning operation, and automatically restarting
the server. The
<a class="link" href="privileges-provided.html#priv_clone-admin">
<code class="literal">
CLONE_ADMIN
</code>
</a>
privilege includes
<a class="link" href="privileges-provided.html#priv_backup-admin">
<code class="literal">
BACKUP_ADMIN
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_shutdown">
<code class="literal">
SHUTDOWN
</code>
</a>
privileges
implicitly.
</p>
</li>
</ul>
</div>
<p>
Instructions for creating the clone user and granting the
required privileges are included in the remote cloning example
that follows this prerequisite information.
</p>
<p>
The following prerequisites are checked when the
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
INSTANCE
</code>
</a>
statement is executed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The donor and recipient must be the same MySQL server
series, such as 8.4.0 and 8.4.11. To determine the MySQL
server version, issue the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58255659"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'version'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> version <span class="token punctuation">|</span> 8.4.3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
The donor and recipient MySQL server instances must run on
the same operating system and platform. For example, if
the donor instance runs on a Linux 64-bit platform, the
recipient instance must also run on that platform. Refer
to your operating system documentation for information
about how to determine your operating system platform.
</p>
</li>
<li class="listitem">
<p>
The recipient must have enough disk space for the cloned
data. By default, user-created data (schemas, tables,
tablespaces) and binary logs are removed on the recipient
prior to cloning the donor data, so you only require
enough space for the donor data. If you clone to a named
directory using the
<code class="literal">
DATA DIRECTORY
</code>
clause, you must have enough disk space for the existing
recipient data and the cloned data. You can estimate the
size of your data by checking the data directory size on
your file system and the size of any tablespaces that
reside outside of the data directory. When estimating data
size on the donor, remember that only
<code class="literal">
InnoDB
</code>
data is cloned. If you store
data in other storage engines, adjust your data size
estimate accordingly.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
permits creating some tablespace
types outside of the data directory. If the donor MySQL
server instance has tablespaces that reside outside of the
data directory, the cloning operation must be able access
those tablespaces. You can query the Information Schema
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table to identify
tablespaces that reside outside of the data directory.
Files that reside outside of the data directory have a
fully qualified path to a directory other than the data
directory.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa75248760"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Plugins that are active on the donor, including any
keyring plugin, must also be active on the recipient. You
can identify active plugins by issuing a
<a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
<code class="literal">
SHOW PLUGINS
</code>
</a>
statement or
by querying the Information Schema
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
The donor and recipient must have the same MySQL server
character set and collation. For information about MySQL
server character set and collation configuration, see
<a class="xref" href="charset-configuration.html" title="12.15 Character Set Configuration">
Section 12.15, “Character Set Configuration”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The same
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
settings are required on the donor and recipient. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
setting on the donor and recipient must specify the same
number of data files of an equivalent size. You can check
variable settings using
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW
VARIABLES
</code>
</a>
syntax.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88138840"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'innodb_page_size'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'innodb_data_file_path'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If cloning encrypted or page-compressed data, the donor
and recipient must have the same file system block size.
For page-compressed data, the recipient file system must
support sparse files and hole punching for hole punching
to occur on the recipient. For information about these
features and how to identify tables and tablespaces that
use them, see
<a class="xref" href="clone-plugin-encrypted-data.html" title="7.6.7.5 Cloning Encrypted Data">
Section 7.6.7.5, “Cloning Encrypted Data”
</a>
, and
<a class="xref" href="clone-plugin-compressed-data.html" title="7.6.7.6 Cloning Compressed Data">
Section 7.6.7.6, “Cloning Compressed Data”
</a>
. To
determine your file system block size, refer to your
operating system documentation.
</p>
</li>
<li class="listitem">
<p>
A secure connection is required if you are cloning
encrypted data. See
<a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
Configuring an Encrypted Connection for Cloning
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
<code class="literal">
clone_valid_donor_list
</code>
</a>
setting on the recipient must include the host address of
the donor MySQL server instance. You can only clone data
from a host on the valid donor list. A MySQL user with the
<a class="link" href="privileges-provided.html#priv_system-variables-admin">
<code class="literal">
SYSTEM_VARIABLES_ADMIN
</code>
</a>
privilege is required to configure this variable.
Instructions for setting the
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
<code class="literal">
clone_valid_donor_list
</code>
</a>
variable are provided in the remote cloning example that
follows this section. You can check the
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
<code class="literal">
clone_valid_donor_list
</code>
</a>
setting using
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW
VARIABLES
</code>
</a>
syntax.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87065006"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'clone_valid_donor_list'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
There must be no other cloning operation running. Only a
single cloning operation is permitted at a time. To
determine if a clone operation is running, query the
<a class="link" href="performance-schema-clone-status-table.html" title="29.12.19.1 The clone_status Table">
<code class="literal">
clone_status
</code>
</a>
table. See
<a class="xref" href="clone-plugin-monitoring.html#clone-plugin-monitoring-performance-schema-clone-tables" title="Monitoring Cloning Operations using Performance Schema Clone Tables">
Monitoring Cloning Operations using Performance Schema Clone Tables
</a>
.
</p>
</li>
<li class="listitem">
<p>
The clone plugin transfers data in 1MB packets plus
metadata. The minimum required
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
value
is therefore 2MB on the donor and the recipient MySQL
server instances. A
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
value
less than 2MB results in an error. Use the following query
to check your
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
setting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa1153174"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'max_allowed_packet'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The following prerequisites also apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Undo tablespace file names on the donor must be unique.
When data is cloned to the recipient, undo tablespaces,
regardless of their location on the donor, are cloned to
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
location on the recipient or to the directory specified by
the
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
clause,
if used. Duplicate undo tablespace file names on the donor
are not permitted for this reason. An error is reported if
duplicate undo tablespace file names are encountered
during a cloning operation.
</p>
<p>
To view undo tablespace file names on the donor to ensure
that they are unique, query the
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72841030"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> TABLESPACE_NAME<span class="token punctuation">,</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES
<span class="token keyword">WHERE</span> FILE_TYPE <span class="token operator">LIKE</span> <span class="token string">'UNDO LOG'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For information about dropping and adding undo tablespace
files, see
<a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
Section 17.6.3.4, “Undo Tablespaces”
</a>
.
</p>
</li>
<li class="listitem">
<p>
By default, the recipient MySQL server instance is
restarted (stopped and started) automatically after the
data is cloned. For an automatic restart to occur, a
monitoring process must be available on the recipient to
detect server shutdowns. Otherwise, the cloning operation
halts with the following error after the data is cloned,
and the recipient MySQL server instance is shut down:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa80238229"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token output">ERROR 3707 (HY000)<span class="token punctuation">:</span> Restart server failed (mysqld is not managed by supervisor process).</span></code></pre>
</div>
<p>
This error does not indicate a cloning failure. It means
that the recipient MySQL server instance must be started
again manually after the data is cloned. After starting
the server manually, you can connect to the recipient
MySQL server instance and check the Performance Schema
clone tables to verify that the cloning operation
completed successfully (see
<a class="xref" href="clone-plugin-monitoring.html#clone-plugin-monitoring-performance-schema-clone-tables" title="Monitoring Cloning Operations using Performance Schema Clone Tables">
Monitoring Cloning Operations using Performance Schema Clone Tables
</a>
.)
The
<a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
<code class="literal">
RESTART
</code>
</a>
statement has
the same monitoring process requirement. For more
information, see
<a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
Section 15.7.8.8, “RESTART Statement”
</a>
. This
requirement is not applicable if cloning to a named
directory using the
<code class="literal">
DATA DIRECTORY
</code>
clause, as an automatic restart is not performed in this
case.
</p>
</li>
<li class="listitem">
<p>
Several variables control various aspects of a remote
cloning operation. Before performing a remote cloning
operation, review the variables and adjust settings as
necessary to suit your computing environment. Clone
variables are set on recipient MySQL server instance where
the cloning operation is executed. See
<a class="xref" href="clone-plugin-options-variables.html" title="7.6.7.13 Clone System Variables">
Section 7.6.7.13, “Clone System Variables”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="clone-plugin-remote-example">
</a>
Cloning Remote Data
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255520240">
</a>
<p>
The following example demonstrates cloning remote data. By
default, a remote cloning operation removes user-created data
(schemas, tables, tablespaces) and binary logs on the
recipient, clones the new data to the recipient data
directory, and restarts the MySQL server afterward.
</p>
<p>
The example assumes that remote cloning prerequisites are met.
See
<a class="xref" href="clone-plugin-remote.html#clone-remote-prerequisites" title="Remote Cloning Prerequisites">
Remote Cloning Prerequisites
</a>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Login to the donor MySQL server instance with an
administrative user account.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="a">
<li class="listitem">
<p>
Create a clone user with the
<a class="link" href="privileges-provided.html#priv_backup-admin">
<code class="literal">
BACKUP_ADMIN
</code>
</a>
privilege.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34830859"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">GRANT</span> BACKUP_ADMIN <span class="token keyword">on</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">to</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Install the clone plugin:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa20018049"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> <span class="token keyword">clone</span> <span class="token keyword">SONAME</span> <span class="token string">'mysql_clone.so'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>
Login to the recipient MySQL server instance with an
administrative user account.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="a">
<li class="listitem">
<p>
Create a clone user with the
<a class="link" href="privileges-provided.html#priv_clone-admin">
<code class="literal">
CLONE_ADMIN
</code>
</a>
privilege.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51786768"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'recipient_clone_user'</span>@<span class="token string">'example.recipient.host.com'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">GRANT</span> CLONE_ADMIN <span class="token keyword">on</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">to</span> <span class="token string">'recipient_clone_user'</span>@<span class="token string">'example.recipient.host.com'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Install the clone plugin:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10897120"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> <span class="token keyword">clone</span> <span class="token keyword">SONAME</span> <span class="token string">'mysql_clone.so'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Add the host address of the donor MySQL server
instance to the
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
<code class="literal">
clone_valid_donor_list
</code>
</a>
variable setting.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa44932794"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> clone_valid_donor_list <span class="token operator">=</span> <span class="token string">'<em class="replaceable">example.donor.host.com</em>:<em class="replaceable">3306</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>
Log on to the recipient MySQL server instance as the clone
user you created previously
(
<code class="literal">
recipient_clone_user'@'example.recipient.host.com
</code>
)
and execute the
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
INSTANCE
</code>
</a>
statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69649039"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span>:<span class="token number">3306</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
After the data is cloned, the MySQL server instance on the
recipient is restarted automatically.
</p>
<p>
For information about monitoring cloning operation status
and progress, see
<a class="xref" href="clone-plugin-monitoring.html" title="7.6.7.10 Monitoring Cloning Operations">
Section 7.6.7.10, “Monitoring Cloning Operations”
</a>
.
</p>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="clone-plugin-remote-named-directory">
</a>
Cloning to a Named Directory
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255489136">
</a>
<p>
By default, a remote cloning operation removes user-created
data (schemas, tables, tablespaces) and binary logs from the
recipient data directory before cloning data from the donor
MySQL Server instance. By cloning to a named directory, you
can avoid removing data from the current recipient data
directory.
</p>
<p>
The procedure for cloning to a named directory is the same
procedure described in
<a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-example" title="Cloning Remote Data">
Cloning Remote Data
</a>
with one
exception: The
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
INSTANCE
</code>
</a>
statement must include the
<code class="literal">
DATA
DIRECTORY
</code>
clause. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96341863"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">example.donor.host.com</em>'</span>:<span class="token number"><em class="replaceable">3306</em></span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/path/to/clone_dir</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
An absolute path is required, and the directory must not
exist. The MySQL server must have the necessary write access
to create the directory.
</p>
<p>
When cloning to a named directory, the recipient MySQL server
instance is not restarted automatically after the data is
cloned. If you want to restart the MySQL server on the named
directory, you must do so manually:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87325247"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqld_safe</span> <span class="token constant">--datadir</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">/path/to/clone_dir</em></span></code></pre>
</div>
<p>
where
<em class="replaceable">
<code>
/path/to/clone_dir
</code>
</em>
is the
path to the named directory on the recipient.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="clone-plugin-remote-ssl">
</a>
Configuring an Encrypted Connection for Cloning
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255475440">
</a>
<p>
You can configure an encrypted connection for remote cloning
operations to protect data as it is cloned over the network.
An encrypted connection is required by default when cloning
encrypted data. (see
<a class="xref" href="clone-plugin-encrypted-data.html" title="7.6.7.5 Cloning Encrypted Data">
Section 7.6.7.5, “Cloning Encrypted Data”
</a>
.)
</p>
<p>
The instructions that follow describe how to configure the
recipient MySQL server instance to use an encrypted
connection. It is assumed that the donor MySQL server instance
is already configured to use encrypted connections. If not,
refer to
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
for
server-side configuration instructions.
</p>
<p>
To configure the recipient MySQL server instance to use an
encrypted connection:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Make the client certificate and key files of the donor
MySQL server instance available to the recipient host.
Either distribute the files to the recipient host using a
secure channel or place them on a mounted partition that
is accessible to the recipient host. The client
certificate and key files to make available include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="filename">
ca.pem
</code>
</p>
<p>
The self-signed certificate authority (CA) file.
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
client-cert.pem
</code>
</p>
<p>
The client public key certificate file.
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
client-key.pem
</code>
</p>
<p>
The client private key file.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Configure the following SSL options on the recipient MySQL
server instance.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_ca">
<code class="literal">
clone_ssl_ca
</code>
</a>
</p>
<p>
Specifies the path to the self-signed certificate
authority (CA) file.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_cert">
<code class="literal">
clone_ssl_cert
</code>
</a>
</p>
<p>
Specifies the path to the client public key
certificate file.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_key">
<code class="literal">
clone_ssl_key
</code>
</a>
</p>
<p>
Specifies the path to the client private key file.
</p>
</li>
</ul>
</div>
<p>
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa44394653"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">clone_ssl_ca</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/ca.pem</span>
<span class="token constant">clone_ssl_cert</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/client-cert.pem</span>
<span class="token constant">clone_ssl_key</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/client-key.pem</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To require that an encrypted connection is used, include
the
<code class="literal">
REQUIRE SSL
</code>
clause when issuing the
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
</code>
</a>
statement on the
recipient.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46693073"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">example.donor.host.com</em>'</span>:<span class="token number"><em class="replaceable">3306</em></span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/path/to/clone_dir</em>'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">SSL</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If an SSL clause is not specified, the clone plugin
attempts to establish an encrypted connection by default,
falling back to an unencrypted connection if the encrypted
connection attempt fails.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you are cloning encrypted data, an encrypted
connection is required by default regardless of whether
the
<code class="literal">
REQUIRE SSL
</code>
clause is specified.
Using
<code class="literal">
REQUIRE NO SSL
</code>
causes an error
if you attempt to clone encrypted data.
</p>
</div>
</li>
</ol>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-security">
</a>
25.6.21 NDB Cluster Security Issues
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-cluster-security-networking-issues.html">
25.6.21.1 NDB Cluster Security and Networking Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-security-mysql-privileges.html">
25.6.21.2 NDB Cluster and MySQL Privileges
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-security-mysql-security-procedures.html">
25.6.21.3 NDB Cluster and MySQL Security Procedures
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045087120352">
</a>
<p>
This section discusses security considerations to take into
account when setting up and running NDB Cluster.
</p>
<p>
Topics covered in this section include the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
NDB Cluster and network security issues
</p>
</li>
<li class="listitem">
<p>
Configuration issues relating to running NDB Cluster securely
</p>
</li>
<li class="listitem">
<p>
NDB Cluster and the MySQL privilege system
</p>
</li>
<li class="listitem">
<p>
MySQL standard security procedures as applicable to NDB
Cluster
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-statements-with-runtimes-in-95th-percentile.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-statements-with-runtimes-in-95th-percentile">
</a>
30.4.3.38 The statements_with_runtimes_in_95th_percentile and
x$statements_with_runtimes_in_95th_percentile Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062095344">
</a>
<a class="indexterm" name="idm46045062093888">
</a>
<a class="indexterm" name="idm46045062092368">
</a>
<a class="indexterm" name="idm46045062090848">
</a>
<p>
These views list statements with runtimes in the 95th
percentile. By default, rows are sorted by descending average
latency.
</p>
<p>
Both views use two helper views,
<code class="literal">
x$ps_digest_avg_latency_distribution
</code>
and
<code class="literal">
x$ps_digest_95th_percentile_by_avg_us
</code>
.
</p>
<p>
The
<a class="link" href="sys-statements-with-runtimes-in-95th-percentile.html" title="30.4.3.38 The statements_with_runtimes_in_95th_percentile and x$statements_with_runtimes_in_95th_percentile Views">
<code class="literal">
statements_with_runtimes_in_95th_percentile
</code>
</a>
and
<a class="link" href="sys-statements-with-runtimes-in-95th-percentile.html" title="30.4.3.38 The statements_with_runtimes_in_95th_percentile and x$statements_with_runtimes_in_95th_percentile Views">
<code class="literal">
x$statements_with_runtimes_in_95th_percentile
</code>
</a>
views have these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
query
</code>
</p>
<p>
The normalized statement string.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
db
</code>
</p>
<p>
The default database for the statement, or
<code class="literal">
NULL
</code>
if there is none.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
full_scan
</code>
</p>
<p>
The total number of full table scans performed by
occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
exec_count
</code>
</p>
<p>
The total number of times the statement has executed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
err_count
</code>
</p>
<p>
The total number of errors produced by occurrences of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
warn_count
</code>
</p>
<p>
The total number of warnings produced by occurrences of
the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_latency
</code>
</p>
<p>
The maximum single wait time of timed occurrences of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed occurrence of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
rows_sent
</code>
</p>
<p>
The total number of rows returned by occurrences of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
rows_sent_avg
</code>
</p>
<p>
The average number of rows returned per occurrence of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
rows_examined
</code>
</p>
<p>
The total number of rows read from storage engines by
occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
rows_examined_avg
</code>
</p>
<p>
The average number of rows read from storage engines per
occurrence of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
first_seen
</code>
</p>
<p>
The time at which the statement was first seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
last_seen
</code>
</p>
<p>
The time at which the statement was most recently seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
digest
</code>
</p>
<p>
The statement digest.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/open.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="open">
</a>
15.6.6.4 Cursor OPEN Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176114048">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa19370034"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">OPEN</span> <span class="token keyword"><em class="replaceable">cursor_name</em></span></code></pre>
</div>
<p>
This statement opens a previously declared cursor. For an
example, see
<a class="xref" href="cursors.html" title="15.6.6 Cursors">
Section 15.6.6, “Cursors”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-upgrade.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="group-replication-upgrade">
</a>
20.8 Upgrading Group Replication
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-online-upgrade-combining-versions.html">
20.8.1 Combining Different Member Versions in a Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-offline-upgrade.html">
20.8.2 Group Replication Offline Upgrade
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-online-upgrade.html">
20.8.3 Group Replication Online Upgrade
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045131668208">
</a>
<p>
This section explains how to upgrade a Group Replication setup. The
basic process of upgrading members of a group is the same as
upgrading stand-alone instances, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
for
the actual process of doing upgrade and types available. Choosing
between an in-place or logical upgrade depends on the amount of data
stored in the group. Usually an in-place upgrade is faster, and
therefore is recommended. You should also consult
<a class="xref" href="replication-upgrade.html" title="19.5.3 Upgrading or Downgrading a Replication Topology">
Section 19.5.3, “Upgrading or Downgrading a Replication Topology”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Before MySQL 8.4, a server would not join a group if it was
running a lower MySQL Server version than the lowest group
member's version. For example, for a group with S1 (8.0.30), S2
(8.0.31), and S3 (8.0.32), the joining member needs to be 8.0.30
or higher. MySQL 8.4 allows all versions within the 8.4 series to
join. For example, an 8.4.0 server could join a group consisting
of S1 (8.4.1) and S2 (8.4.2).
</p>
</div>
<p>
While you are in the process of upgrading an online group, in order
to maximize availability, you might need to have members with
different MySQL Server versions running at the same time. Group
Replication includes compatibility policies that enable you to
safely combine members running different versions of MySQL in the
same group during the upgrade procedure. Depending on your group,
the effects of these policies might affect the order in which you
should upgrade group members. For details, see
<a class="xref" href="group-replication-online-upgrade-combining-versions.html" title="20.8.1 Combining Different Member Versions in a Group">
Section 20.8.1, “Combining Different Member Versions in a Group”
</a>
.
</p>
<p>
If your group can be taken fully offline see
<a class="xref" href="group-replication-offline-upgrade.html" title="20.8.2 Group Replication Offline Upgrade">
Section 20.8.2, “Group Replication Offline Upgrade”
</a>
. If your group
needs to remain online, as is common with production deployments,
see
<a class="xref" href="group-replication-online-upgrade.html" title="20.8.3 Group Replication Online Upgrade">
Section 20.8.3, “Group Replication Online Upgrade”
</a>
for the
different approaches available for upgrading a group with minimal
downtime.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation-apt-repo.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="linux-installation-apt-repo">
</a>
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045331262624">
</a>
<a class="indexterm" name="idm46045331261136">
</a>
<p>
This section provides guidance on installing MySQL using the MySQL
APT repository.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="apt-repo-fresh-install">
</a>
Steps for a Fresh Installation of MySQL
</h4>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The following instructions assume that no version of MySQL
(whether distributed by Oracle or other parties) has already
been installed on your system; if that is not the case, follow
the instructions given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-replacing" title="Replacing a Native Distribution of MySQL Using the MySQL APT Repository">
Replacing a Native Distribution of MySQL Using the MySQL APT Repository
</a>
or
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-replace-direct" title="Replacing a MySQL Server Installed by a Direct deb Package Download">
Replacing a MySQL Server Installed by a Direct deb Package Download
</a>
instead.
</p>
</div>
<p>
<a name="apt-repo-setup">
</a>
<b>
Adding the MySQL Apt Repository.
</b>
First, add the MySQL APT repository to your system's software
repository list. Follow these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Go to the download page for the MySQL APT repository at
<a class="ulink" href="https://dev.mysql.com/downloads/repo/apt/" target="_top">
https://dev.mysql.com/downloads/repo/apt/
</a>
.
</p>
</li>
<li class="listitem">
<p>
Select and download the release package for your Linux
distribution.
</p>
<p>
Although this is not required for each update, it does update
MySQL repository information to include the current
information, which includes adding a new LTS series.
</p>
</li>
<li class="listitem">
<p>
Install the downloaded release package with the following
command, replacing
<em class="replaceable">
<code>
version-specific-package-name
</code>
</em>
with
the name of the downloaded package (preceded by its path, if
you are not running the command inside the folder where the
package is):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28240030"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg <span class="token property">-i</span> <em class="replaceable">/PATH/version-specific-package-name</em><span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
For example, for version
<em class="replaceable">
<code>
w.x.y-z
</code>
</em>
of
the package, the command is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa72126332"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg <span class="token property">-i</span> mysql-apt-config_<em class="replaceable">w<span class="token punctuation">.</span>x<span class="token punctuation">.</span>y-z</em>_all<span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
Note that the same package works on all supported Debian and
Ubuntu platforms.
</p>
</li>
<li class="listitem">
<p>
During the installation of the package, you will be asked to
choose the versions of the MySQL server and other components
(for example, the MySQL Workbench) that you want to install.
If you are not sure which version to choose, do not change the
default options selected for you. You can also choose
<span class="guilabel">
none
</span>
if you do not want a particular
component to be installed. After making the choices for all
components, choose
<span class="guilabel">
Ok
</span>
to finish the
configuration and installation of the release package.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The innovation track, which begins with MySQL 8.1, includes
"-innovation-" in the component name.
</p>
</div>
<p>
You can always change your choices for the versions later; see
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-select-series" title="Selecting a Major Release Version">
Selecting a Major Release Version
</a>
for instructions.
</p>
</li>
<li class="listitem">
<p>
Update package information from the MySQL APT repository with
the following command (
<span class="emphasis">
<em>
this step is
mandatory
</em>
</span>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa46748109"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
</li>
</ol>
</div>
<p>
Instead of using the release package, you can also add and
configure the MySQL APT repository manually; see
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-repo-manual-setup" title="Appendix A: Adding and Configuring the MySQL APT Repository Manually">
Appendix A: Adding and Configuring the MySQL APT Repository Manually
</a>
for details.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Once the MySQL APT repository is enabled on your system, you
will no longer be able to install any MySQL packages from your
platform's native software repositories until the MySQL APT
repository is disabled.
</p>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Once the MySQL APT repository is enabled on your system, any
system-wide upgrade by the
<span class="command">
<strong>
apt-get upgrade
</strong>
</span>
command will automatically upgrade the MySQL packages on your
system and also replace any native MySQL packages you installed
from your Linux distribution's software repository, if APT finds
replacements for them from within the MySQL APT repository.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-select-series">
</a>
Selecting a Major Release Version
</h4>
</div>
</div>
</div>
<p>
By default, all installations and upgrades for your MySQL server
and the other required components come from the release series of
the major version you have selected during the installation of the
configuration package (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
).
However, you can switch to another supported major release series
at any time by reconfiguring the configuration package you have
installed. Use the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa81673278"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg-reconfigure mysql-apt-config</code></pre>
</div>
<p>
A dialogue box then asks you to choose the major release version
you want. Make your selection and choose
<span class="guilabel">
Ok
</span>
.
After returning to the command prompt, update package information
from the MySQL APT repository with this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa20863362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
<p>
The latest version in the selected series will then be installed
when you use the
<span class="command">
<strong>
apt-get install
</strong>
</span>
command next
time.
</p>
<p>
You can use the same method to change the version for any other
MySQL component you want to install with the MySQL APT repository.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-installing">
</a>
Installing MySQL with APT
</h4>
</div>
</div>
</div>
<p>
Install MySQL by the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa53448850"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-server</code></pre>
</div>
<p>
This installs the package for the MySQL server, as well as the
packages for the client and for the database common files.
</p>
<p>
During the installation, you are asked to supply a password for
the root user for your MySQL installation.
</p>
<p>
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Make sure you remember the root password you set. Users who
want to set a password later can leave the
<span class="guilabel">
password
</span>
field blank in the dialogue box
and just press
<span class="guilabel">
Ok
</span>
; in that case, root
access to the server will be authenticated by
<a class="xref" href="socket-pluggable-authentication.html" title="8.4.1.10 Socket Peer-Credential Pluggable Authentication">
Section 8.4.1.10, “Socket Peer-Credential Pluggable Authentication”
</a>
for
connections using a Unix socket file. You can set the root
password later using the program
<a class="link" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
<span class="command">
<strong>
mysql_secure_installation
</strong>
</span>
</a>
.
</p>
</div>
<p>
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-starting-and-stopping-server">
</a>
Starting and Stopping the MySQL Server
</h4>
</div>
</div>
</div>
<p>
The MySQL server is started automatically after installation. You
can check the status of the MySQL server with the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa97474173"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> status mysql</code></pre>
</div>
<p>
</p>
<p>
If the operating system is systemd enabled, standard
<span class="command">
<strong>
systemctl
</strong>
</span>
(or alternatively,
<span class="command">
<strong>
service
</strong>
</span>
with the arguments reversed) commands
such as
<span class="command">
<strong>
stop
</strong>
</span>
,
<span class="command">
<strong>
start
</strong>
</span>
,
<span class="command">
<strong>
status
</strong>
</span>
, and
<a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
<span class="command">
<strong>
restart
</strong>
</span>
</a>
should
be used to manage the MySQL server service. The
<code class="literal">
mysql
</code>
service is enabled by default, and it
starts at system reboot. See
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
for
additional information.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A few third-party native repository packages that have
dependencies on the native MySQL packages may not work with the
MySQL APT repository packages and should not be used together
with them; these include akonadi-backend-mysql,
handlersocket-mysql-5.5, and zoneminder.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="apt-repo-install-components">
</a>
Installing Additional MySQL Products and Components with APT
</h4>
</div>
</div>
</div>
<p>
You can use APT to install individual components of MySQL from the
MySQL APT repository. Assuming you already have the MySQL APT
repository on your system's repository list (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
for instructions), first, use the
following command to get the latest package information from the
MySQL APT repository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77024338"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
<p>
Install any packages of your choice with the following command,
replacing
<em class="replaceable">
<code>
package-name
</code>
</em>
with name of the
package to install:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa1431099"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install <em class="replaceable">package-name</em></code></pre>
</div>
<p>
For example, to install the MySQL Workbench:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31908770"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-workbench-community</code></pre>
</div>
<p>
To install the shared client libraries:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa38793543"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install libmysqlclient21</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qp-apt-install-from-source">
</a>
Installing MySQL from Source with the MySQL APT Repository
</h4>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This feature is only supported on 64-bit systems.
</p>
</div>
<p>
You can download the source code for MySQL and build it using the
MySQL APT Repository:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Add the MySQL APT repository to your system's repository list
and choose the major release series you want (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
for instructions).
</p>
</li>
<li class="listitem">
<p>
Update package information from the MySQL APT repository with
the following command (
<span class="emphasis">
<em>
this step is
mandatory
</em>
</span>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa78960407"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
</li>
<li class="listitem">
<p>
Install packages that the build process depends on:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa99788003"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get build-dep mysql-server</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Download the source code for the major components of MySQL and
then build them (run this command in the folder in which you
want the downloaded files and the builds to be located):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77513134"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">apt-get</span> source <span class="token property">-b</span> mysql-server</code></pre>
</div>
<p>
<code class="filename">
deb
</code>
packages for installing the various
MySQL components are created.
</p>
</li>
<li class="listitem">
<p>
Pick the
<code class="filename">
deb
</code>
packages for the MySQL
components you need and install them with the command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa80435395"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg <span class="token property">-i</span> <em class="replaceable">package-name</em><span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
Notice that dependency relationships exist among the MySQL
packages. For a basic installation of the MySQL server,
install the database common files package, the client package,
the client metapackage, the server package, and the server
metapackage (in that order) with the following steps:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Preconfigure the MySQL server package with the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa11450984"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg-preconfigure mysql-community-server_<em class="replaceable">version-and-platform-specific-part</em><span class="token punctuation">.</span>deb</code></pre>
</div>
<p>
You will be asked to provide a password for the root
user for your MySQL installation; see important
information on root password given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-installing" title="Installing MySQL with APT">
Installing MySQL with APT
</a>
above. You
might also be asked other questions regarding the
installation.
</p>
</li>
<li class="listitem">
<p>
Install the required packages with a single command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa45392927"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg <span class="token property">-i</span> mysql-<span class="token punctuation">{</span>common<span class="token punctuation">,</span>community-client<span class="token punctuation">,</span>client<span class="token punctuation">,</span>community-server<span class="token punctuation">,</span>server<span class="token punctuation">}</span>_*<span class="token punctuation">.</span>deb</code></pre>
</div>
</li>
<li class="listitem">
<p>
If you are being warned of unmet dependencies by
<span class="command">
<strong>
dpkg
</strong>
</span>
, you can fix them using
<span class="command">
<strong>
apt-get
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa17768816"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">sudo apt-get <span class="token property">-f</span> install</code></pre>
</div>
</li>
</ul>
</div>
<p>
Here are where the files are installed on the system:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
All configuration files (like
<code class="filename">
my.cnf
</code>
) are under
<code class="filename">
/etc/mysql
</code>
</p>
</li>
<li class="listitem">
<p>
All binaries, libraries, headers, etc., are under
<code class="filename">
/usr/bin
</code>
and
<code class="filename">
/usr/sbin
</code>
</p>
</li>
<li class="listitem">
<p>
The data directory is under
<code class="filename">
/var/lib/mysql
</code>
</p>
</li>
</ul>
</div>
<p>
</p>
</li>
</ol>
</div>
<p>
See also information given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-starting-and-stopping-server" title="Starting and Stopping the MySQL Server">
Starting and Stopping the MySQL Server
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-upgrading">
</a>
Upgrading MySQL with the MySQL APT Repository
</h4>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Notes
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Before performing any upgrade to MySQL, follow carefully the
instructions in
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
. Among other
instructions discussed there,
<span class="emphasis">
<em>
it is especially
important to back up your database before the
upgrade
</em>
</span>
.
</p>
</li>
<li class="listitem">
<p>
The following instructions assume that MySQL has been
installed on your system using the MySQL APT repository; if
that is not the case, follow the instructions given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-replacing" title="Replacing a Native Distribution of MySQL Using the MySQL APT Repository">
Replacing a Native Distribution of MySQL Using the MySQL APT Repository
</a>
or
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-replace-direct" title="Replacing a MySQL Server Installed by a Direct deb Package Download">
Replacing a MySQL Server Installed by a Direct deb Package Download
</a>
instead. Also
notice that you cannot use the MySQL APT repository to
upgrade a distribution of MySQL that you have installed from
a nonnative software repository (for example, from MariaDB
or Percona).
</p>
</li>
</ul>
</div>
</div>
<p>
Use the MySQL APT repository to perform an in-place upgrade for
your MySQL installation (that is, replacing the old version and
then running the new version using the old data files) by
following these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Make sure you already have the MySQL APT repository on your
system's repository list (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
for instructions).
</p>
</li>
<li class="listitem">
<p>
Make sure you have the most up-to-date package information on
the MySQL APT repository by running:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa39373985"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Note that, by default, the MySQL APT repository will update
MySQL to the release series you have selected when you were
<a class="link" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
adding the MySQL APT repository
to your system
</a>
. If you want to upgrade to another
release series, select it by following the steps given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-select-series" title="Selecting a Major Release Version">
Selecting a Major Release Version
</a>
.
</p>
<p>
As a general rule, to upgrade from one release series to
another, go to the next series rather than skipping a series.
For example, if you are currently running MySQL 5.7 and wish
to upgrade to a newer series, upgrade to MySQL 8.0 first
before upgrading to 8.4.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
In-place downgrading of MySQL is not supported by the
MySQL APT repository. Follow the instructions in
<a class="xref" href="downgrading.html" title="Chapter 4 Downgrading MySQL">
Chapter 4,
<i>
Downgrading MySQL
</i>
</a>
.
</p>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
<a name="apt-repo-upgrade-step4">
</a>
Upgrade MySQL by the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa7407432"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-server</code></pre>
</div>
<p>
The MySQL server, client, and the database common files are
upgraded if newer versions are available. To upgrade any other
MySQL package, use the same
<span class="command">
<strong>
apt-get install
</strong>
</span>
command and supply the name for the package you want to
upgrade:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31871417"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install <em class="replaceable">package-name</em></code></pre>
</div>
<p>
To see the names of the packages you have installed from the
MySQL APT repository, use the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa84827827"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">dpkg</span> <span class="token property">-l</span> | grep mysql | grep ii</code></pre>
</div>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you perform a system-wide upgrade using
<span class="command">
<strong>
apt-get
upgrade
</strong>
</span>
, only the MySQL library and development
packages are upgraded with newer versions (if available). To
upgrade other components including the server, client, test
suite, etc., use the
<span class="command">
<strong>
apt-get install
</strong>
</span>
command.
</p>
</div>
</li>
<li class="listitem">
<p>
The MySQL server always restarts after an update by APT.
</p>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-replacing">
</a>
Replacing a Native Distribution of MySQL Using the MySQL APT Repository
</h4>
</div>
</div>
</div>
<p>
Variants and forks of MySQL are distributed by different parties
through their own software repositories or download sites. You can
replace a native distribution of MySQL installed from your Linux
platform's software repository with a distribution from the MySQL
APT repository in a few steps.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The MySQL APT repository can only replace distributions of MySQL
maintained and distributed by Debian or Ubuntu. It cannot
replace any MySQL forks found either inside or outside of the
distributions' native repositories. To replace such MySQL forks,
you have to uninstall them first before you install MySQL using
the MySQL APT repository. Follow the instructions for
uninstallation from the forks' distributors and, before you
proceed, make sure you back up your data and you know how to
restore them to a new server.
</p>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
A few third-party native repository packages that have
dependencies on the native MySQL packages may not work with the
MySQL APT repository packages and should not be used together
with them; these include akonadi-backend-mysql,
handlersocket-mysql-5.5, and zoneminder.
</p>
</div>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<h5>
<a name="idm46045331115728">
</a>
Backing Up Your Database
</h5>
<p>
To avoid loss of data, always back up your database before
trying to replace your MySQL installation using the MySQL APT
repository. See
<a class="xref" href="backup-and-recovery.html" title="Chapter 9 Backup and Recovery">
Chapter 9,
<i>
Backup and Recovery
</i>
</a>
for
instructions.
</p>
</li>
<li class="listitem">
<h5>
<a name="idm46045331113328">
</a>
Adding the MySQL APT Repository and Selecting a Release Series
</h5>
<p>
Add the MySQL APT repository to your system's repository list
and select the release series you want by following the
instructions given in
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
.
</p>
</li>
<li class="listitem">
<h5>
<a name="repo-qg-apt-replace-native">
</a>
Replacing the Native Distribution by an APT Update
</h5>
<p>
By design, the MySQL APT repository replaces your native
distribution of MySQL when you perform upgrades on the MySQL
packages. To perform the upgrades, follow the same
instructions given in
<a class="link" href="linux-installation-apt-repo.html#apt-repo-upgrade-step4">
Step 4
</a>
in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-upgrading" title="Upgrading MySQL with the MySQL APT Repository">
Upgrading MySQL with the MySQL APT Repository
</a>
.
</p>
</li>
</ol>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Once the native distribution of MySQL has been replaced using
the MySQL APT repository, purging the old MySQL packages from
the native repository using the
<span class="command">
<strong>
apt-get
purge
</strong>
</span>
,
<span class="command">
<strong>
apt-get remove --purge
</strong>
</span>
, or
<span class="command">
<strong>
dpkg -P
</strong>
</span>
command might impact the newly
installed MySQL server in various ways. Therefore,
<span class="emphasis">
<em>
do
not purge the old MySQL packages from the native repository
packages
</em>
</span>
.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-replace-direct">
</a>
Replacing a MySQL Server Installed by a Direct deb Package Download
</h4>
</div>
</div>
</div>
<p>
<code class="filename">
deb
</code>
packages from MySQL for installing the
MySQL server and its components can either be downloaded from the
<a class="ulink" href="https://dev.mysql.com/downloads/" target="_top">
MySQL Developer Zone's MySQL
Download page
</a>
or from the MySQL APT repository. The
<code class="filename">
deb
</code>
packages from the two sources are
different, and they install and configure MySQL in different ways.
</p>
<p>
If you have installed MySQL with the MySQL Developer Zone's
<code class="filename">
deb
</code>
packages and now want to replace the
installation using the ones from the MySQL APT repository, follow
these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Back up your database. See
<a class="xref" href="backup-and-recovery.html" title="Chapter 9 Backup and Recovery">
Chapter 9,
<i>
Backup and Recovery
</i>
</a>
for instructions.
</p>
</li>
<li class="listitem">
<p>
Follow the steps given previously for
<a class="link" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
adding the MySQL APT
repository
</a>
.
</p>
</li>
<li class="listitem">
<p>
Remove the old installation of MySQL by running:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa91306310"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> dpkg <span class="token property">-P</span> mysql</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Install MySQL from the MySQL APT repository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa72856576"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-server</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
If needed, restore the data on the new MySQL installation. See
<a class="xref" href="backup-and-recovery.html" title="Chapter 9 Backup and Recovery">
Chapter 9,
<i>
Backup and Recovery
</i>
</a>
for instructions.
</p>
</li>
</ol>
</div>
<h5>
<a name="apt-repo-remove">
</a>
Removing MySQL with APT
</h5>
<p>
To uninstall the MySQL server and the related components that have
been installed using the MySQL APT repository, first, remove the
MySQL server using the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa96360370"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get remove mysql-server</code></pre>
</div>
<p>
Then, remove any other software that was installed automatically
with the MySQL server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa86234803"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get autoremove</code></pre>
</div>
<p>
To uninstall other components, use the following command,
replacing
<strong class="userinput">
<code>
package-name
</code>
</strong>
with the name of the
package of the component you want to remove:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa56401643"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get remove <em class="replaceable">package-name</em></code></pre>
</div>
<p>
To see a list of packages you have installed from the MySQL APT
repository, use the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa79802222"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">dpkg</span> <span class="token property">-l</span> | grep mysql | grep ii</code></pre>
</div>
<h5>
<a name="updating-apt-repo-client-lib">
</a>
Special Notes on Upgrading the Shared Client Libraries
</h5>
<p>
You can install the shared client libraries from MySQL APT
repository by the following command (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-install-components" title="Installing Additional MySQL Products and Components with APT">
Installing Additional MySQL Products and Components with APT
</a>
for more details):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28082218"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install libmysqlclient21</code></pre>
</div>
<p>
If you already have the shared client libraries installed from you
Linux platform's software repository, it can be updated by the
MySQL APT repository with its own package by using the same
command (see
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-replace-native" title="Replacing the Native Distribution by an APT Update">
Replacing the Native Distribution by an APT Update
</a>
for more
details).
</p>
<p>
After updating MySQL using the APT repository, applications
compiled with older versions of the shared client libraries should
continue to work.
</p>
<p>
<span class="emphasis">
<em>
If you recompile applications and dynamically link them
with the updated libraries:
</em>
</span>
as typical with new
versions of shared libraries, any applications compiled using the
updated, newer shared libraries might require those updated
libraries on systems where the applications are deployed. If those
libraries are not in place, the applications requiring the shared
libraries might fail. Therefore, it is recommended that the
packages for the shared libraries from MySQL be deployed on those
systems. You can do this by adding the MySQL APT repository to the
systems (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
) and installing the
latest shared client libraries using the command given at the
beginning of this section.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-cluster-install">
</a>
Installing MySQL NDB Cluster Using the APT Repository
</h4>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Notes
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The MySQL APT repository supports installation of MySQL NDB Cluster on
Debian and Ubuntu systems. For methods to install NDB Cluster on
other Debian-based systems, see
<a class="ulink" href="/doc/refman/5.7/en/mysql-cluster-install-debian.html" target="_top">
Installing NDB Cluster Using .deb Files
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you already have the MySQL server or MySQL NDB Cluster installed on
your system, make sure it is stopped and you have your data
and configuration files backed up before proceeding.
</p>
</li>
</ul>
</div>
</div>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<h5>
<a name="apt-repo-setup-cluster">
</a>
Adding the MySQL APT Repository for MySQL NDB Cluster
</h5>
<p>
Follow the steps in
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup" title="Adding the MySQL Apt Repository">
Adding the MySQL Apt Repository
</a>
to add
the MySQL APT repository to your system's repository list.
During the installation process of the configuration package,
when you are asked which MySQL product you want to configure,
choose
<span class="quote">
“
<span class="quote">
MySQL Server & Cluster
</span>
”
</span>
; when asked
which version you wish to receive, choose
<span class="quote">
“
<span class="quote">
mysql-cluster-
<em class="replaceable">
<code>
x
</code>
</em>
.
<em class="replaceable">
<code>
y
</code>
</em>
.
</span>
”
</span>
After returning to the command prompt, go to Step 2 below.
</p>
<p>
If you already have the configuration package installed on
your system, make sure it is up-to-date by running the
following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa30244396"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-apt-config</code></pre>
</div>
<p>
Then, use the same method described in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-select-series" title="Selecting a Major Release Version">
Selecting a Major Release Version
</a>
to select MySQL NDB Cluster
for installation. When you are asked which MySQL product you
want to configure, choose
<span class="quote">
“
<span class="quote">
MySQL Server &
Cluster
</span>
”
</span>
; when asked which version you wish to receive,
choose
<span class="quote">
“
<span class="quote">
mysql-cluster-
<em class="replaceable">
<code>
x
</code>
</em>
.
<em class="replaceable">
<code>
y
</code>
</em>
.
</span>
”
</span>
After returning to the command prompt, update package
information from the MySQL APT repository with this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31401997"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<h5>
<a name="idm46045331049152">
</a>
Installing MySQL NDB Cluster
</h5>
<p>
For a minimal installation of MySQL NDB Cluster, follow these
steps:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="repo-qg-apt-installing-cluster-server">
</a>
Install the components for SQL nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93121815"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-cluster-community-server</code></pre>
</div>
<p>
You will be asked to provide a password for the root user
for your SQL node; see important information on the root
password given in
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-installing" title="Installing MySQL with APT">
Installing MySQL with APT
</a>
above. You might also be asked other questions regarding
the installation.
</p>
</li>
<li class="listitem">
<p>
Install the executables for management nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa8135494"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-cluster-community-management-server</code></pre>
</div>
</li>
<li class="listitem">
<p>
Install the executables for data nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa81402745"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get install mysql-cluster-community-data-node</code></pre>
</div>
</li>
</ul>
</div>
</li>
<li class="listitem">
<h5>
<a name="idm46045331037568">
</a>
Configuring and Starting MySQL NDB Cluster
</h5>
<p>
See
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
on
how to configure MySQL NDB Cluster and
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
on how to
start it for the first time. When following those
instructions, adjust them according to the following details
regarding the SQL nodes of your NDB Cluster installation:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
All configuration files (like
<code class="filename">
my.cnf
</code>
)
are under
<code class="filename">
/etc/mysql
</code>
</p>
</li>
<li class="listitem">
<p>
All binaries, libraries, headers, etc., are under
<code class="filename">
/usr/bin
</code>
and
<code class="filename">
/usr/sbin
</code>
</p>
</li>
<li class="listitem">
<p>
The data directory is
<code class="filename">
/var/lib/mysql
</code>
</p>
</li>
</ul>
</div>
</li>
</ol>
</div>
<h5>
<a name="apt-repo-install-cluster-components">
</a>
Installing Additional MySQL NDB Cluster Products and Components
</h5>
<p>
You can use APT to install individual components and additional
products of MySQL NDB Cluster from the MySQL APT repository. To do that,
assuming you already have the MySQL APT repository on your
system's repository list (see
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-setup-cluster" title="Adding the MySQL APT Repository for MySQL NDB Cluster">
Adding the MySQL Apt Repository for MySQL NDB Cluster
</a>
), follow the same steps
given in
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-install-components" title="Installing Additional MySQL Products and Components with APT">
Installing Additional MySQL Products and Components with APT
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<span class="emphasis">
<em>
Known issue:
</em>
</span>
Currently, not all
components required for running the MySQL NDB Cluster test suite are
installed automatically when you install the test suite
package (
<code class="literal">
mysql-cluster-community-test
</code>
).
Install the following packages with
<span class="command">
<strong>
apt-get
install
</strong>
</span>
before you run the test suite:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-auto-installer
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-management-server
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-data-node
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-memcached
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-java
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ndbclient-dev
</code>
</p>
</li>
</ul>
</div>
</div>
<p>
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="repo-qg-apt-repo-manual-setup">
</a>
Appendix A: Adding and Configuring the MySQL APT Repository Manually
</h4>
</div>
</div>
</div>
<p>
Here are the steps for adding manually the MySQL APT repository to
your system's software repository list and configuring it, without
using the release packages provided by MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Download the MySQL GPG Public key (see
<a class="xref" href="checking-gpg-signature.html" title="2.1.4.2 Signature Checking Using GnuPG">
Section 2.1.4.2, “Signature Checking Using GnuPG”
</a>
on how to do that)
and save it to a file, without adding any spaces or special
characters. Then, add the key to your system's GPG keyring
with the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa41750964"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-key add <em class="replaceable">path/to/signature-file</em></code></pre>
</div>
</li>
<li class="listitem">
<p>
Alternatively, you can download the GPG key to your APT
keyring directly using the apt-key utility:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93262093"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-key adv <span class="token property">--keyserver</span> pgp<span class="token punctuation">.</span>mit<span class="token punctuation">.</span>edu <span class="token property">--recv-keys</span> A8D3785C</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The KeyID for MySQL 8.0.36 and later release packages is
<code class="literal">
A8D3785C
</code>
, as shown above. For earlier
MySQL releases, the keyID is
<code class="literal">
3A79BD29
</code>
.
Using an incorrect key can cause a key verification error.
</p>
</div>
</li>
<li class="listitem">
<p>
Create a file named
<code class="filename">
/etc/apt/sources.list.d/mysql.list
</code>
, and
put into it repository entries in the following format (this
is not a command to execute):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa6224115"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">deb http<span class="token operator">:</span><span class="token operator">/</span><span class="token operator">/</span>repo<span class="token punctuation">.</span>mysql<span class="token punctuation">.</span>com<span class="token operator">/</span>apt<span class="token operator">/</span><span class="token punctuation">{</span>debian<span class="token operator">|</span>ubuntu<span class="token punctuation">}</span><span class="token operator">/</span> <span class="token punctuation">{</span>bookworm<span class="token operator">|</span>jammy<span class="token punctuation">}</span> <span class="token punctuation">{</span>mysql<span class="token operator">-</span>tools<span class="token operator">|</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token operator">-</span>lts<span class="token operator">|</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>0<span class="token punctuation">}</span></code></pre>
</div>
<p>
Pick the relevant options for your repository set up:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Choose
<span class="quote">
“
<span class="quote">
debian
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
ubuntu
</span>
”
</span>
according to your platform.
</p>
</li>
<li class="listitem">
<p>
Choose the appropriate version name for the version of
your system; examples include
<span class="quote">
“
<span class="quote">
bookworm
</span>
”
</span>
(for Debian 12) and
<span class="quote">
“
<span class="quote">
jammy
</span>
”
</span>
(for Ubuntu
22.04).
</p>
</li>
<li class="listitem">
<p>
For installing the MySQL server, client, and database
common files, choose
<span class="quote">
“
<span class="quote">
mysql-8.4
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
mysql-8.0
</span>
”
</span>
, or
<span class="quote">
“
<span class="quote">
mysql-innovation
</span>
”
</span>
according to the
<a class="link" href="mysql-releases.html" title="1.3 MySQL Releases: Innovation and LTS">
MySQL series
</a>
you
want. To switch to another release series later, come
back and adjust the entry with your new choice. This
also includes access to tools such as MySQL Router and
MySQL Shell.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you already have a version of MySQL installed on
your system, do not choose a lower version at this
step, or it might result in an unsupported downgrade
operation.
</p>
</div>
</li>
<li class="listitem">
<p>
Include
<span class="quote">
“
<span class="quote">
mysql-tools
</span>
”
</span>
to install a
connector.
</p>
</li>
</ul>
</div>
<p>
For example, on the Ubuntu 22.04 platform use these lines in
your
<code class="filename">
mysql.list
</code>
files to install MySQL
8.4 and the latest MySQL Connectors from the MySQL APT
repository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa58080488"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">deb http<span class="token operator">:</span><span class="token operator">/</span><span class="token operator">/</span>repo<span class="token punctuation">.</span>mysql<span class="token punctuation">.</span>com<span class="token operator">/</span>apt<span class="token operator">/</span>ubuntu<span class="token operator">/</span> jammy mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4 mysql<span class="token operator">-</span>tools</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Use the following command to get the most up-to-date package
information from the MySQL APT repository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa8571942"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> apt-get update</code></pre>
</div>
<p>
</p>
</li>
</ul>
</div>
<p>
</p>
<p>
You have configured your system to use the MySQL APT repository
and are now ready to continue with
<a class="xref" href="linux-installation-apt-repo.html#repo-qg-apt-installing" title="Installing MySQL with APT">
Installing MySQL with APT
</a>
or
<a class="xref" href="linux-installation-apt-repo.html#apt-repo-install-components" title="Installing Additional MySQL Products and Components with APT">
Installing Additional MySQL Products and Components with APT
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation-native.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="linux-installation-native">
</a>
2.5.7 Installing MySQL on Linux from the Native Software Repositories
</h3>
</div>
</div>
</div>
<p>
Many Linux distributions include a version of the MySQL server,
client tools, and development components in their native software
repositories and can be installed with the platforms' standard
package management systems. This section provides basic
instructions for installing MySQL using those package management
systems.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Native packages are often several versions behind the currently
available release. You are also normally unable to install
development milestone releases (DMRs), since these are not
usually made available in the native repositories. Before
proceeding, we recommend that you check out the other
installation options described in
<a class="xref" href="linux-installation.html" title="2.5 Installing MySQL on Linux">
Section 2.5, “Installing MySQL on Linux”
</a>
.
</p>
</div>
<p>
Distribution specific instructions are shown below:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="bold">
<strong>
Red Hat Linux, Fedora, CentOS
</strong>
</span>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For a number of Linux distributions, you can install MySQL
using the MySQL Yum repository instead of the platform's
native software repository. See
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
for details.
</p>
</div>
<p>
For Red Hat and similar distributions, the MySQL distribution
is divided into a number of separate packages,
<code class="literal">
mysql
</code>
for the client tools,
<code class="literal">
mysql-server
</code>
for the server and associated
tools, and
<code class="literal">
mysql-libs
</code>
for the libraries.
The libraries are required if you want to provide connectivity
from different languages and environments such as Perl, Python
and others.
</p>
<p>
To install, use the
<span class="command">
<strong>
yum
</strong>
</span>
command to specify
the packages that you want to install. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89044246"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">#> </span><span class="token command">yum</span> install mysql mysql-server mysql-libs mysql-server
Loaded plugins<span class="token punctuation">:</span> presto<span class="token punctuation">,</span> refresh-packagekit
Setting up Install Process
Resolving Dependencies
<span class="token property">--></span> Running transaction check
<span class="token property">---></span> Package mysql<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">---></span> Package mysql-libs<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">---></span> Package mysql-server<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">--></span> Processing Dependency<span class="token punctuation">:</span> perl-DBD-MySQL for package<span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64
<span class="token property">--></span> Running transaction check
<span class="token property">---></span> Package perl-DBD-MySQL<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">--></span> Finished Dependency Resolution
Dependencies Resolved
<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
Package Arch Version Repository Size
<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
Installing<span class="token punctuation">:</span>
mysql x86_64 5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 updates 889 k
mysql-libs x86_64 5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 updates 1<span class="token punctuation">.</span>2 M
mysql-server x86_64 5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 updates 8<span class="token punctuation">.</span>1 M
Installing for dependencies<span class="token punctuation">:</span>
perl-DBD-MySQL x86_64 4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13 updates 136 k
Transaction Summary
<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
Install 4 Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
Upgrade 0 Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
Total download size<span class="token punctuation">:</span> 10 M
Installed size<span class="token punctuation">:</span> 30 M
Is this ok <span class="token punctuation">[</span>y/N<span class="token punctuation">]</span><span class="token punctuation">:</span> y
Downloading Packages<span class="token punctuation">:</span>
Setting up and reading Presto delta metadata
Processing delta metadata
Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span> data still to download<span class="token punctuation">:</span> 10 M
<span class="token punctuation">(</span>1/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm | 889 kB 00<span class="token punctuation">:</span>04
<span class="token punctuation">(</span>2/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-libs-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm | 1<span class="token punctuation">.</span>2 MB 00<span class="token punctuation">:</span>06
<span class="token punctuation">(</span>3/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm | 8<span class="token punctuation">.</span>1 MB 00<span class="token punctuation">:</span>40
<span class="token punctuation">(</span>4/4<span class="token punctuation">)</span><span class="token punctuation">:</span> perl-DBD-MySQL-4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm | 136 kB 00<span class="token punctuation">:</span>00
<span class="token property">--------------------------------------------------------------------------------</span>
Total 201 kB/s | 10 MB 00<span class="token punctuation">:</span>52
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing <span class="token punctuation">:</span> mysql-libs-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64 1/4
Installing <span class="token punctuation">:</span> mysql-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64 2/4
Installing <span class="token punctuation">:</span> perl-DBD-MySQL-4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64 3/4
Installing <span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64 4/4
Installed<span class="token punctuation">:</span>
mysql<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 mysql-libs<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13
mysql-server<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13
Dependency Installed<span class="token punctuation">:</span>
perl-DBD-MySQL<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13
Complete!</code></pre>
</div>
<p>
MySQL and the MySQL server should now be installed. A sample
configuration file is installed into
<code class="filename">
/etc/my.cnf
</code>
. To start the MySQL server
use
<span class="command">
<strong>
systemctl
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa2983937"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> start mysqld</code></pre>
</div>
<p>
The database tables are automatically created for you, if they
do not already exist. You should, however, run
<a class="link" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
<span class="command">
<strong>
mysql_secure_installation
</strong>
</span>
</a>
to set the root
passwords on your server.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Debian, Ubuntu, Kubuntu
</strong>
</span>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For supported Debian and Ubuntu versions, MySQL can be
installed using the
<a class="ulink" href="https://dev.mysql.com/downloads/repo/apt/" target="_top">
MySQL APT
Repository
</a>
instead of the platform's native software
repository. See
<a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
</a>
for details.
</p>
</div>
<p>
On Debian and related distributions, there are two packages
for MySQL in their software repositories,
<code class="literal">
mysql-client
</code>
and
<code class="literal">
mysql-server
</code>
, for the client and server
components respectively. You should specify an explicit
version, for example
<code class="literal">
mysql-client-5.1
</code>
, to
ensure that you install the version of MySQL that you want.
</p>
<p>
To download and install, including any dependencies, use the
<span class="command">
<strong>
apt-get
</strong>
</span>
command, specifying the packages
that you want to install.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Before installing, make sure that you update your
<code class="literal">
apt-get
</code>
index files to ensure you are
downloading the latest available version.
</p>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<span class="command">
<strong>
apt-get
</strong>
</span>
command installs a number of
packages, including the MySQL server, in order to provide
the typical tools and application environment. This can mean
that you install a large number of packages in addition to
the main MySQL package.
</p>
</div>
<p>
During installation, the initial database is created, and you
are prompted for the MySQL root password (and confirmation). A
configuration file is created in
<code class="filename">
/etc/mysql/my.cnf
</code>
. An init script is
created in
<code class="filename">
/etc/init.d/mysql
</code>
.
</p>
<p>
The server should already be started. You can manually start
and stop the server using:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa22286223"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">#> </span><span class="token command">service</span> mysql <span class="token punctuation">[</span>start|stop<span class="token punctuation">]</span></code></pre>
</div>
<p>
The service is automatically added to the 2, 3 and 4 run
levels, with stop scripts in the single, shutdown and restart
levels.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replica-connection-thread-states.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replica-connection-thread-states">
</a>
10.14.7 Replication Connection Thread States
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045221048288">
</a>
<a class="indexterm" name="idm46045221046800">
</a>
<p>
These thread states occur on a replica server but are associated
with connection threads, not with the I/O or SQL threads.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221043136">
</a>
<a class="indexterm" name="idm46045221041648">
</a>
<code class="literal">
Changing master
</code>
</p>
<p>
<a class="indexterm" name="idm46045221039088">
</a>
<a class="indexterm" name="idm46045221037584">
</a>
<code class="literal">
Changing replication source
</code>
</p>
<p>
The thread is processing a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE
REPLICATION SOURCE TO
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221032816">
</a>
<a class="indexterm" name="idm46045221031328">
</a>
<code class="literal">
Killing slave
</code>
</p>
<p>
The thread is processing a
<code class="literal">
STOP REPLICA
</code>
statement.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221026976">
</a>
<a class="indexterm" name="idm46045221025472">
</a>
<code class="literal">
Opening master dump table
</code>
</p>
<p>
This state occurs after
<code class="literal">
Creating table from master
dump
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221021312">
</a>
<a class="indexterm" name="idm46045221019808">
</a>
<code class="literal">
Reading master dump table data
</code>
</p>
<p>
This state occurs after
<code class="literal">
Opening master dump
table
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221015664">
</a>
<a class="indexterm" name="idm46045221014144">
</a>
<code class="literal">
Rebuilding the index on master dump table
</code>
</p>
<p>
This state occurs after
<code class="literal">
Reading master dump table
data
</code>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-arbitrator-validity-detail.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-arbitrator-validity-detail">
</a>
25.6.17.1 The ndbinfo arbitrator_validity_detail Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045090564112">
</a>
<p>
The
<code class="literal">
arbitrator_validity_detail
</code>
table shows
the view that each data node in the cluster has of the
arbitrator. It is a subset of the
<a class="link" href="mysql-cluster-ndbinfo-membership.html" title="25.6.17.45 The ndbinfo membership Table">
<code class="literal">
membership
</code>
</a>
table.
</p>
<p>
The
<code class="literal">
arbitrator_validity_detail
</code>
table contains
the following columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
node_id
</code>
</p>
<p>
This node's node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arbitrator
</code>
</p>
<p>
Node ID of arbitrator
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arb_ticket
</code>
</p>
<p>
Internal identifier used to track arbitration
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arb_connected
</code>
</p>
<p>
Whether this node is connected to the arbitrator; either of
<code class="literal">
Yes
</code>
or
<code class="literal">
No
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
arb_state
</code>
</p>
<p>
Arbitration state
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045090547552">
</a>
Notes
</h5>
<p>
The node ID is the same as that reported by
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm -e
"SHOW"
</strong>
</span>
</a>
.
</p>
<p>
All nodes should show the same
<code class="literal">
arbitrator
</code>
and
<code class="literal">
arb_ticket
</code>
values as well as the same
<code class="literal">
arb_state
</code>
value. Possible
<code class="literal">
arb_state
</code>
values are
<code class="literal">
ARBIT_NULL
</code>
,
<code class="literal">
ARBIT_INIT
</code>
,
<code class="literal">
ARBIT_FIND
</code>
,
<code class="literal">
ARBIT_PREP1
</code>
,
<code class="literal">
ARBIT_PREP2
</code>
,
<code class="literal">
ARBIT_START
</code>
,
<code class="literal">
ARBIT_RUN
</code>
,
<code class="literal">
ARBIT_CHOOSE
</code>
,
<code class="literal">
ARBIT_CRASH
</code>
, and
<code class="literal">
UNKNOWN
</code>
.
</p>
<p>
<code class="literal">
arb_connected
</code>
shows whether the current node
is connected to the
<code class="literal">
arbitrator
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-master-status.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-master-status">
</a>
15.7.7.24 SHOW MASTER STATUS Statement (no longer supported)
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170105008">
</a>
<p>
This statement is no longer supported, and has been replaced by
<a class="link" href="show-binary-log-status.html" title="15.7.7.1 SHOW BINARY LOG STATUS Statement">
<code class="literal">
SHOW BINARY LOG STATUS
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-distributed-recovery-connections.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-distributed-recovery-connections">
</a>
20.5.4.1 Connections for Distributed Recovery
</h4>
</div>
</div>
</div>
<p>
When a joining member connects to an online existing member for
state transfer during distributed recovery, the joining member
acts as a client on the connection and the existing member acts
as a server. When state transfer from the donor's binary log is
in progress over this connection (using the asynchronous
replication channel
<code class="literal">
group_replication_recovery
</code>
), the joining
member acts as the replica and the existing member acts as the
source. When a remote cloning operation is in progress over this
connection, the joining member acts as a recipient and the
existing member acts as a donor. Configuration settings that
apply to those roles outside the Group Replication context can
apply for Group Replication also, unless they are overridden by
a Group Replication-specific configuration setting or behavior.
</p>
<p>
The connection that an existing member offers to a joining
member for distributed recovery is not the same connection that
is used by Group Replication for communication between online
members of the group.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The connection used by the group communication engine for
Group Replication (XCom, a Paxos variant) for TCP
communication between remote XCom instances is specified by
the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
system variable. This connection is used for TCP/IP messages
between online members. Communication with the local
instance is over an input channel using shared memory.
</p>
</li>
<li class="listitem">
<p>
For distributed recovery, by default, group members offer
their standard SQL client connection to joining members, as
specified by
<a class="link" href="server-system-variables.html#sysvar_hostname">
<code class="literal">
hostname
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_port">
<code class="literal">
port
</code>
</a>
. If an alternative
port number is specified by
<a class="link" href="replication-options-replica.html#sysvar_report_port">
<code class="literal">
report_port
</code>
</a>
, that one is
used instead.
</p>
</li>
<li class="listitem">
<p>
Group members may instead advertise an alternative list of
distributed recovery endpoints as dedicated client
connections for joining members, allowing you to control
distributed recovery traffic separately from connections by
regular client users of the member. A member transmits the
list of distributed recovery endpoints specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_advertise_recovery_endpoints">
<code class="literal">
group_replication_advertise_recovery_endpoints
</code>
</a>
to the group when it joins. By default, the member continues
to offer the standard SQL client connection as in earlier
releases.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Distributed recovery can fail if a joining member cannot
correctly identify the other members using the host name as
defined by MySQL Server's
<a class="link" href="server-system-variables.html#sysvar_hostname">
<code class="literal">
hostname
</code>
</a>
system variable. It
is recommended that operating systems running MySQL have a
properly configured unique host name, either using DNS or
local settings. The host name that the server is using for SQL
client connections can be verified in the
<code class="literal">
Member_host
</code>
column of the Performance
Schema table
<a class="link" href="performance-schema-replication-group-members-table.html" title="29.12.11.16 The replication_group_members Table">
<code class="literal">
replication_group_members
</code>
</a>
. If
multiple group members externalize a default host name set by
the operating system, there is a chance of the joining member
not resolving it to the correct member address and not being
able to connect for distributed recovery. In this situation
you can use MySQL Server's
<a class="link" href="replication-options-replica.html#sysvar_report_host">
<code class="literal">
report_host
</code>
</a>
system variable
to configure a unique host name to be externalized by each of
the servers.
</p>
</div>
<p>
The steps for a joining member to establish a connection for
distributed recovery are as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
When the member joins the group, it connects with one of the
seed members included in the list in its
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_seeds">
<code class="literal">
group_replication_group_seeds
</code>
</a>
system variable, initially using the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
connection as specified in that list. The seed members might
be a subset of the group.
</p>
</li>
<li class="listitem">
<p>
Over this connection, the seed member uses Group
Replication's membership service to provide the joining
member with a list of all the members that are online in the
group, in the form of a view. The membership information
includes the details of the distributed recovery endpoints
or standard SQL client connection offered by each member for
distributed recovery.
</p>
</li>
<li class="listitem">
<p>
The joining member selects a suitable group member from this
list to be its donor for distributed recovery, following the
behaviors described in
<a class="xref" href="group-replication-distributed-recovery-fault.html" title="20.5.4.4 Fault Tolerance for Distributed Recovery">
Section 20.5.4.4, “Fault Tolerance for Distributed Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The joining member then attempts to connect to the donor
using the donor's advertised distributed recovery endpoints,
trying each in turn in the order they are specified in the
list. If the donor provides no endpoints, the joining member
attempts to connect using the donor's standard SQL client
connection. The SSL requirements for the connection are as
specified by the
<code class="literal">
group_replication_recovery_ssl_*
</code>
options
described in
<a class="xref" href="group-replication-distributed-recovery-connections.html#group-replication-distributed-recovery-connections-ssl" title="20.5.4.1.4 SSL and Authentication for Distributed Recovery">
Section 20.5.4.1.4, “SSL and Authentication for Distributed Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If the joining member is not able to connect to the selected
donor, it retries with other suitable donors, following the
behaviors described in
<a class="xref" href="group-replication-distributed-recovery-fault.html" title="20.5.4.4 Fault Tolerance for Distributed Recovery">
Section 20.5.4.4, “Fault Tolerance for Distributed Recovery”
</a>
.
Note that if the joining member exhausts the list of
advertised endpoints without making a connection, it does
not fall back to the donor's standard SQL client connection,
but switches to another donor.
</p>
</li>
<li class="listitem">
<p>
When the joining member establishes a distributed recovery
connection with a donor, it uses that connection for state
transfer as described in
<a class="xref" href="group-replication-distributed-recovery.html" title="20.5.4 Distributed Recovery">
Section 20.5.4, “Distributed Recovery”
</a>
.
The host and port for the connection that is used are shown
in the joining member's log. Note that if a remote cloning
operation is used, when the joining member has restarted at
the end of the operation, it establishes a connection with a
new donor for state transfer from the binary log. This might
be a connection to a different member from the original
donor used for the remote cloning operation, or it might be
a different connection to the original donor. In any case,
the distributed recovery process continues in the same way
as it would have with the original donor.
</p>
</li>
</ol>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-distributed-recovery-connections-endpoints">
</a>
20.5.4.1.1 Selecting addresses for distributed recovery endpoints
</h5>
</div>
</div>
</div>
<p>
IP addresses supplied by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_advertise_recovery_endpoints">
<code class="literal">
group_replication_advertise_recovery_endpoints
</code>
</a>
system variable as distributed recovery endpoints do not have
to be configured for MySQL Server (that is, they do not have
to be specified by the
<a class="link" href="server-system-variables.html#sysvar_admin_address">
<code class="literal">
admin_address
</code>
</a>
system variable
or in the list for the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system
variable). They do have to be assigned to the server. Any host
names used must resolve to a local IP address. IPv4 and IPv6
addresses can be used.
</p>
<p>
The ports supplied for the distributed recovery endpoints do
have to be configured for MySQL Server, so they must be
specified by the
<a class="link" href="server-system-variables.html#sysvar_port">
<code class="literal">
port
</code>
</a>
,
<a class="link" href="replication-options-replica.html#sysvar_report_port">
<code class="literal">
report_port
</code>
</a>
, or
<a class="link" href="server-system-variables.html#sysvar_admin_port">
<code class="literal">
admin_port
</code>
</a>
system variable.
The server must listen for TCP/IP connections on these ports.
If you specify the
<a class="link" href="server-system-variables.html#sysvar_admin_port">
<code class="literal">
admin_port
</code>
</a>
, the replication
user for distributed recovery needs the
<a class="link" href="privileges-provided.html#priv_service-connection-admin">
<code class="literal">
SERVICE_CONNECTION_ADMIN
</code>
</a>
privilege to connect. Selecting the
<a class="link" href="server-system-variables.html#sysvar_admin_port">
<code class="literal">
admin_port
</code>
</a>
keeps distributed
recovery connections separate from regular MySQL client
connections.
</p>
<p>
Joining members try each of the endpoints in turn in the order
they are specified on the list. If
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_advertise_recovery_endpoints">
<code class="literal">
group_replication_advertise_recovery_endpoints
</code>
</a>
is set to
<code class="literal">
DEFAULT
</code>
rather than a list of
endpoints, the standard SQL client connection is offered. Note
that the standard SQL client connection is not automatically
included on a list of distributed recovery endpoints, and is
not offered as a fallback if the donor's list of endpoints is
exhausted without a connection. If you want to offer the
standard SQL client connection as one of a number of
distributed recovery endpoints, you must include it explicitly
in the list specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_advertise_recovery_endpoints">
<code class="literal">
group_replication_advertise_recovery_endpoints
</code>
</a>
.
You can put it in the last place so that it acts as a last
resort for connection.
</p>
<p>
A group member's distributed recovery endpoints (or standard
SQL client connection if endpoints are not provided) do not
need to be added to the Group Replication allowlist specified
by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
system variable. The allowlist is only for the address
specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
for each member. A joining member must have its initial
connection to the group permitted by the allowlist in order to
retrieve the address or addresses for distributed recovery.
</p>
<p>
The distributed recovery endpoints that you list are validated
when the system variable is set and when a
<a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
<code class="literal">
START GROUP_REPLICATION
</code>
</a>
statement has been issued. If the list cannot be parsed
correctly, or if any of the endpoints cannot be accessed on
the host because the server is not listening on them, Group
Replication logs an error and does not start.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-recovery-compression">
</a>
20.5.4.1.2 Compression for Distributed Recovery
</h5>
</div>
</div>
</div>
<p>
You can optionally configure compression for distributed
recovery by the method of state transfer from a donor's
binary log. Compression can benefit distributed recovery where
network bandwidth is limited and the donor has to transfer
many transactions to the joining member. The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_compression_algorithms">
<code class="literal">
group_replication_recovery_compression_algorithms
</code>
</a>
and
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_zstd_compression_level">
<code class="literal">
group_replication_recovery_zstd_compression_level
</code>
</a>
system variables determine permitted compression algorithms,
and the
<code class="literal">
zstd
</code>
compression level used when
carrying out state transfer from a donor's binary log.
For more information, see
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
.
</p>
<p>
These compression settings do not apply to remote cloning
operations. When a remote cloning operation is used for
distributed recovery, the clone plugin's setting for
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_enable_compression">
<code class="literal">
clone_enable_compression
</code>
</a>
applies.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-distributed-recovery-connections-user">
</a>
20.5.4.1.3 Replication User for Distributed Recovery
</h5>
</div>
</div>
</div>
<p>
Distributed recovery requires a replication user that has the
correct permissions so that Group Replication can establish
direct member-to-member replication channels. The replication
user must also have the correct permissions to act as the
clone user on the donor for a remote cloning operation. The
same replication user must be used for distributed recovery on
every group member. For instructions to set up this
replication user, see
<a class="xref" href="group-replication-user-credentials.html" title="20.2.1.3 User Credentials For Distributed Recovery">
Section 20.2.1.3, “User Credentials For Distributed Recovery”
</a>
. For
instructions to secure the replication user credentials, see
<a class="xref" href="group-replication-secure-user.html" title="20.6.3.1 Secure User Credentials for Distributed Recovery">
Section 20.6.3.1, “Secure User Credentials for Distributed Recovery”
</a>
.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-distributed-recovery-connections-ssl">
</a>
20.5.4.1.4 SSL and Authentication for Distributed Recovery
</h5>
</div>
</div>
</div>
<p>
SSL for distributed recovery is configured separately from SSL
for normal group communications, which is determined by the
server's SSL settings and the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ssl_mode">
<code class="literal">
group_replication_ssl_mode
</code>
</a>
system variable. For distributed recovery connections,
dedicated Group Replication distributed recovery SSL system
variables are available to configure the use of certificates
and ciphers specifically for distributed recovery.
</p>
<p>
By default, SSL is not used for distributed recovery
connections. To activate it, set
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_use_ssl">
<code class="literal">
group_replication_recovery_use_ssl=ON
</code>
</a>
,
and configure the Group Replication distributed recovery SSL
system variables as described in
<a class="xref" href="group-replication-distributed-recovery-securing.html" title="20.6.3 Securing Distributed Recovery Connections">
Section 20.6.3, “Securing Distributed Recovery Connections”
</a>
.
You need a replication user that is set up to use SSL.
</p>
<p>
When distributed recovery is configured to use SSL, Group
Replication applies this setting for remote cloning
operations, as well as for state transfer from a donor's
binary log. Group Replication automatically configures the
settings for the clone SSL options
(
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_ca">
<code class="literal">
clone_ssl_ca
</code>
</a>
,
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_cert">
<code class="literal">
clone_ssl_cert
</code>
</a>
, and
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_key">
<code class="literal">
clone_ssl_key
</code>
</a>
) to match your
settings for the corresponding Group Replication distributed
recovery options
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_ssl_ca">
<code class="literal">
group_replication_recovery_ssl_ca
</code>
</a>
,
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_ssl_cert">
<code class="literal">
group_replication_recovery_ssl_cert
</code>
</a>
,
and
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_ssl_key">
<code class="literal">
group_replication_recovery_ssl_key
</code>
</a>
).
</p>
<p>
If you are not using SSL for distributed recovery (so
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_use_ssl">
<code class="literal">
group_replication_recovery_use_ssl
</code>
</a>
is set to
<code class="literal">
OFF
</code>
), and the replication user
account for Group Replication authenticates with the
<code class="literal">
caching_sha2_password
</code>
plugin (the default)
or the
<code class="literal">
sha256_password
</code>
plugin (deprecated),
RSA key pairs are used for password exchange. In this case,
either use the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_public_key_path">
<code class="literal">
group_replication_recovery_public_key_path
</code>
</a>
system variable to specify the RSA public key file, or use the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_get_public_key">
<code class="literal">
group_replication_recovery_get_public_key
</code>
</a>
system variable to request the public key from the source, as
described in
<a class="xref" href="group-replication-secure-user.html#group-replication-caching-sha2-user-credentials" title="20.6.3.1.1 Replication User With The Caching SHA-2 Authentication Plugin">
Section 20.6.3.1.1, “Replication User With The Caching SHA-2 Authentication Plugin”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-next-key-locking.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-next-key-locking">
</a>
17.7.4 Phantom Rows
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045163891360">
</a>
<a class="indexterm" name="idm46045163890288">
</a>
<a class="indexterm" name="idm46045163888800">
</a>
<a class="indexterm" name="idm46045163887312">
</a>
<a class="indexterm" name="idm46045163885824">
</a>
<a class="indexterm" name="idm46045163884336">
</a>
<a class="indexterm" name="idm46045163882848">
</a>
<a class="indexterm" name="idm46045163881360">
</a>
<a class="indexterm" name="idm46045163879872">
</a>
<p>
The so-called
<span class="firstterm">
phantom
</span>
problem occurs within a transaction when the same query produces
different sets of rows at different times. For example, if a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
is executed twice, but
returns a row the second time that was not returned the first
time, the row is a
<span class="quote">
“
<span class="quote">
phantom
</span>
”
</span>
row.
</p>
<p>
Suppose that there is an index on the
<code class="literal">
id
</code>
column
of the
<code class="literal">
child
</code>
table and that you want to read
and lock all rows from the table having an identifier value larger
than 100, with the intention of updating some column in the
selected rows later:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61472622"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> child <span class="token keyword">WHERE</span> id <span class="token operator">></span> <span class="token number">100</span> <span class="token keyword">FOR</span> <span class="token keyword">UPDATE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The query scans the index starting from the first record where
<code class="literal">
id
</code>
is bigger than 100. Let the table contain
rows having
<code class="literal">
id
</code>
values of 90 and 102. If the
locks set on the index records in the scanned range do not lock
out inserts made in the gaps (in this case, the gap between 90 and
102), another session can insert a new row into the table with an
<code class="literal">
id
</code>
of 101. If you were to execute the same
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
within the same transaction,
you would see a new row with an
<code class="literal">
id
</code>
of 101 (a
<span class="quote">
“
<span class="quote">
phantom
</span>
”
</span>
) in the result set returned by the query.
If we regard a set of rows as a data item, the new phantom child
would violate the isolation principle of transactions that a
transaction should be able to run so that the data it has read
does not change during the transaction.
</p>
<p>
To prevent phantoms,
<code class="literal">
InnoDB
</code>
uses an algorithm
called
<span class="firstterm">
next-key locking
</span>
that
combines index-row locking with gap locking.
<code class="literal">
InnoDB
</code>
performs row-level locking in such a way
that when it searches or scans a table index, it sets shared or
exclusive locks on the index records it encounters. Thus, the
row-level locks are actually index-record locks. In addition, a
next-key lock on an index record also affects the
<span class="quote">
“
<span class="quote">
gap
</span>
”
</span>
before the index record. That is, a next-key
lock is an index-record lock plus a gap lock on the gap preceding
the index record. If one session has a shared or exclusive lock on
record
<code class="literal">
R
</code>
in an index, another session cannot
insert a new index record in the gap immediately before
<code class="literal">
R
</code>
in the index order.
</p>
<p>
When
<code class="literal">
InnoDB
</code>
scans an index, it can also lock
the gap after the last record in the index. Just that happens in
the preceding example: To prevent any insert into the table where
<code class="literal">
id
</code>
would be bigger than 100, the locks set by
<code class="literal">
InnoDB
</code>
include a lock on the gap following
<code class="literal">
id
</code>
value 102.
</p>
<p>
You can use next-key locking to implement a uniqueness check in
your application: If you read your data in share mode and do not
see a duplicate for a row you are going to insert, then you can
safely insert your row and know that the next-key lock set on the
successor of your row during the read prevents anyone meanwhile
inserting a duplicate for your row. Thus, the next-key locking
enables you to
<span class="quote">
“
<span class="quote">
lock
</span>
”
</span>
the nonexistence of something
in your table.
</p>
<p>
Gap locking can be disabled as discussed in
<a class="xref" href="innodb-locking.html" title="17.7.1 InnoDB Locking">
Section 17.7.1, “InnoDB Locking”
</a>
. This may cause phantom problems
because other sessions can insert new rows into the gaps when gap
locking is disabled.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/component-loading.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="component-loading">
</a>
7.5.1 Installing and Uninstalling Components
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045257338080">
</a>
<a class="indexterm" name="idm46045257337040">
</a>
<a class="indexterm" name="idm46045257335552">
</a>
<a class="indexterm" name="idm46045257334480">
</a>
<p>
Components must be loaded into the server before they can be used.
MySQL supports manual component loading at runtime and automatic
loading during server startup.
</p>
<p>
While a component is loaded, information about it is available as
described in
<a class="xref" href="obtaining-component-information.html" title="7.5.2 Obtaining Component Information">
Section 7.5.2, “Obtaining Component Information”
</a>
.
</p>
<p>
The
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL COMPONENT
</code>
</a>
and
<a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
<code class="literal">
UNINSTALL COMPONENT
</code>
</a>
SQL statements
enable component loading and unloading. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88619965"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_validate_password'</span><span class="token punctuation">;</span>
<span class="token keyword">UNINSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_validate_password'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A loader service handles component loading and unloading, and also
registers loaded components in the
<code class="literal">
mysql.component
</code>
system table.
</p>
<p>
The SQL statements for component manipulation affect server
operation and the
<code class="literal">
mysql.component
</code>
system table
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL COMPONENT
</code>
</a>
loads
components into the server. The components become active
immediately. The loader service also registers loaded
components in the
<code class="literal">
mysql.component
</code>
system
table. For subsequent server restarts, the loader service
loads any components listed in
<code class="literal">
mysql.component
</code>
during the startup
sequence. This occurs even if the server is started with the
<a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
<code class="option">
--skip-grant-tables
</code>
</a>
option. The
optional
<code class="literal">
SET
</code>
clause permits setting
component system-variable values when you install components.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
<code class="literal">
UNINSTALL COMPONENT
</code>
</a>
deactivates
components and unloads them from the server. The loader
service also unregisters the components from the
<code class="literal">
mysql.component
</code>
system table so that the
server no longer loads them during its startup sequence for
subsequent restarts.
</p>
</li>
</ul>
</div>
<p>
Compared to the corresponding
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL
PLUGIN
</code>
</a>
statement for server plugins, the
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL COMPONENT
</code>
</a>
statement for
components offers the significant advantage that it is not
necessary to know any platform-specific file name suffix for
naming the component. This means that a given
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL COMPONENT
</code>
</a>
statement can be
executed uniformly across platforms.
</p>
<p>
A component when installed may also automatically install related
loadable functions. If so, the component when uninstalled also
automatically uninstalls those functions.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-changing-group-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-changing-group-mode">
</a>
20.5.1.2 Changing the Group Mode
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133575024">
</a>
<p>
This section explains how to change the mode which a group is
running in, either single or multi-primary. The functions used
to change a group's mode can be run on any member.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-switch-to-single">
</a>
Changing to Single-Primary Mode
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133571840">
</a>
<a class="indexterm" name="idm46045133570336">
</a>
<a class="indexterm" name="idm46045133569216">
</a>
<a class="indexterm" name="idm46045133567728">
</a>
<p>
Use the
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode">
<code class="literal">
group_replication_switch_to_single_primary_mode()
</code>
</a>
function to change a group running in multi-primary mode to
single-primary mode by issuing:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37273645"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_switch_to_single_primary_mode<span class="token punctuation">(</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
When you change to single-primary mode, strict consistency
checks are also disabled on all group members, as required in
single-primary mode
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_enforce_update_everywhere_checks">
<code class="literal">
group_replication_enforce_update_everywhere_checks=OFF
</code>
</a>
).
</p>
<p>
If no string is passed in, the election of the new primary in
the resulting single-primary group follows the election
policies described in
<a class="xref" href="group-replication-single-primary-mode.html" title="20.1.3.1 Single-Primary Mode">
Section 20.1.3.1, “Single-Primary Mode”
</a>
. To
override the election process and configure a specific member
of the multi-primary group as the new primary in the process,
get the
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
of the
member and pass it to
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode">
<code class="literal">
group_replication_switch_to_single_primary_mode()
</code>
</a>
.
For example, issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa1545405"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_switch_to_single_primary_mode<span class="token punctuation">(</span><em class="replaceable">member_uuid</em><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-switch-to-multi">
</a>
Changing to Multi-Primary Mode
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133553520">
</a>
<a class="indexterm" name="idm46045133552016">
</a>
<a class="indexterm" name="idm46045133550896">
</a>
<a class="indexterm" name="idm46045133549408">
</a>
<p>
Use the
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode">
<code class="literal">
group_replication_switch_to_multi_primary_mode()
</code>
</a>
function to change a group running in single-primary mode to
multi-primary mode by issuing:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa64055157"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_switch_to_multi_primary_mode<span class="token punctuation">(</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
After some coordinated group operations to ensure the safety
and consistency of your data, all members which belong to the
group become primaries.
</p>
<p>
When you change a group from single-primary mode to
multi-primary mode, members are automatically placed in
read-only mode if they are running a later MySQL server
version than the lowest version present in the group.
</p>
<p>
While the action runs, you can check its progress by issuing
the following
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10637400"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> event_name<span class="token punctuation">,</span> work_completed<span class="token punctuation">,</span> work_estimated <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_stages_current <span class="token keyword">WHERE</span> event_name <span class="token operator">LIKE</span> <span class="token string">"%stage/group_rpl%"</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> event_name <span class="token punctuation">|</span> work_completed <span class="token punctuation">|</span> work_estimated <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/group_rpl/Multi<span class="token punctuation">-</span>primary Switch: applying buffered transactions <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-stage-summary-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-stage-summary-tables">
</a>
29.12.20.2 Stage Summary Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045069047408">
</a>
<a class="indexterm" name="idm46045069045888">
</a>
<a class="indexterm" name="idm46045069044368">
</a>
<a class="indexterm" name="idm46045069042848">
</a>
<a class="indexterm" name="idm46045069041328">
</a>
<a class="indexterm" name="idm46045069039808">
</a>
<a class="indexterm" name="idm46045069038288">
</a>
<a class="indexterm" name="idm46045069036768">
</a>
<a class="indexterm" name="idm46045069035248">
</a>
<a class="indexterm" name="idm46045069033728">
</a>
<p>
The Performance Schema maintains tables for collecting current
and recent stage events, and aggregates that information in
summary tables.
<a class="xref" href="performance-schema-stage-tables.html" title="29.12.5 Performance Schema Stage Event Tables">
Section 29.12.5, “Performance Schema Stage Event Tables”
</a>
describes
the events on which stage summaries are based. See that
discussion for information about the content of stage events,
the current and historical stage event tables, and how to
control stage event collection, which is disabled by default.
</p>
<p>
Example stage event summary information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83357700"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span>
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_stages_summary_global_by_event_name\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
EVENT_NAME<span class="token punctuation">:</span> stage/sql/checking permissions
COUNT_STAR<span class="token punctuation">:</span> 57
SUM_TIMER_WAIT<span class="token punctuation">:</span> 26501888880
MIN_TIMER_WAIT<span class="token punctuation">:</span> 7317456
AVG_TIMER_WAIT<span class="token punctuation">:</span> 464945295
MAX_TIMER_WAIT<span class="token punctuation">:</span> 12858936792
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 9. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
EVENT_NAME<span class="token punctuation">:</span> stage/sql/closing tables
COUNT_STAR<span class="token punctuation">:</span> 37
SUM_TIMER_WAIT<span class="token punctuation">:</span> 662606568
MIN_TIMER_WAIT<span class="token punctuation">:</span> 1593864
AVG_TIMER_WAIT<span class="token punctuation">:</span> 17907891
MAX_TIMER_WAIT<span class="token punctuation">:</span> 437977248
...</span></code></pre>
</div>
<p>
Each stage summary table has one or more grouping columns to
indicate how the table aggregates events. Event names refer to
names of event instruments in the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_account_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
,
<code class="literal">
USER
</code>
, and
<code class="literal">
HOST
</code>
columns. Each row summarizes events for a given account
(user and host combination) and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_host_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
and
<code class="literal">
HOST
</code>
columns. Each row summarizes
events for a given host and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_thread_by_event_name
</code>
</a>
has
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given thread and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_user_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
and
<code class="literal">
USER
</code>
columns. Each row summarizes
events for a given user and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_global_by_event_name
</code>
</a>
has an
<code class="literal">
EVENT_NAME
</code>
column. Each row
summarizes events for a given event name.
</p>
</li>
</ul>
</div>
<p>
Each stage summary table has these summary columns containing
aggregated values:
<code class="literal">
COUNT_STAR
</code>
,
<code class="literal">
SUM_TIMER_WAIT
</code>
,
<code class="literal">
MIN_TIMER_WAIT
</code>
,
<code class="literal">
AVG_TIMER_WAIT
</code>
, and
<code class="literal">
MAX_TIMER_WAIT
</code>
. These columns are analogous
to the columns of the same names in the wait event summary
tables (see
<a class="xref" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
Section 29.12.20.1, “Wait Event Summary Tables”
</a>
),
except that the stage summary tables aggregate events from
<a class="link" href="performance-schema-events-stages-current-table.html" title="29.12.5.1 The events_stages_current Table">
<code class="literal">
events_stages_current
</code>
</a>
rather than
<a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
<code class="literal">
events_waits_current
</code>
</a>
.
</p>
<p>
The stage summary tables have these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_account_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_host_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_thread_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_by_user_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_global_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is permitted for
stage summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For summary tables not aggregated by account, host, or
user, truncation resets the summary columns to zero rather
than removing rows.
</p>
</li>
<li class="listitem">
<p>
For summary tables aggregated by account, host, or user,
truncation removes rows for accounts, hosts, or users with
no connections, and resets the summary columns to zero for
the remaining rows.
</p>
</li>
</ul>
</div>
<p>
In addition, each stage summary table that is aggregated by
account, host, user, or thread is implicitly truncated by
truncation of the connection table on which it depends, or
truncation of
<a class="link" href="performance-schema-stage-summary-tables.html" title="29.12.20.2 Stage Summary Tables">
<code class="literal">
events_stages_summary_global_by_event_name
</code>
</a>
.
For details, see
<a class="xref" href="performance-schema-connection-tables.html" title="29.12.8 Performance Schema Connection Tables">
Section 29.12.8, “Performance Schema Connection Tables”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-myisam-bulk-data-loading.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="optimizing-myisam-bulk-data-loading">
</a>
10.6.2 Bulk Data Loading for MyISAM Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045225767904">
</a>
<p>
These performance tips supplement the general guidelines for
fast inserts in
<a class="xref" href="insert-optimization.html" title="10.2.5.1 Optimizing INSERT Statements">
Section 10.2.5.1, “Optimizing INSERT Statements”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For a
<code class="literal">
MyISAM
</code>
table, you can use
concurrent inserts to add rows at the same time that
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements are
running, if there are no deleted rows in middle of the data
file. See
<a class="xref" href="concurrent-inserts.html" title="10.11.3 Concurrent Inserts">
Section 10.11.3, “Concurrent Inserts”
</a>
.
</p>
</li>
<li class="listitem">
<p>
With some extra work, it is possible to make
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
run even faster for
a
<code class="literal">
MyISAM
</code>
table when the table has many
indexes. Use the following procedure:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Execute a
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
statement or a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
flush-tables
</strong>
</span>
</a>
command.
</p>
</li>
<li class="listitem">
<p>
Use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk --keys-used=0 -rq
<em class="replaceable">
<code>
/path/to/db/tbl_name
</code>
</em>
</strong>
</span>
</a>
to remove all use of indexes for the table.
</p>
</li>
<li class="listitem">
<p>
Insert data into the table with
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
. This does not
update any indexes and therefore is very fast.
</p>
</li>
<li class="listitem">
<p>
If you intend only to read from the table in the future,
use
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
to compress it. See
<a class="xref" href="compressed-format.html" title="18.2.3.3 Compressed Table Characteristics">
Section 18.2.3.3, “Compressed Table Characteristics”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Re-create the indexes with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -rq
<em class="replaceable">
<code>
/path/to/db/tbl_name
</code>
</em>
</strong>
</span>
</a>
.
This creates the index tree in memory before writing it
to disk, which is much faster than updating the index
during
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
because
it avoids lots of disk seeks. The resulting index tree
is also perfectly balanced.
</p>
</li>
<li class="listitem">
<p>
Execute a
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
statement or a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
flush-tables
</strong>
</span>
</a>
command.
</p>
</li>
</ol>
</div>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
performs the
preceding optimization automatically if the
<code class="literal">
MyISAM
</code>
table into which you insert data
is empty. The main difference between automatic optimization
and using the procedure explicitly is that you can let
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
allocate much more temporary
memory for the index creation than you might want the server
to allocate for index re-creation when it executes the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement.
</p>
<p>
You can also disable or enable the nonunique indexes for a
<code class="literal">
MyISAM
</code>
table by using the following
statements rather than
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
. If you
use these statements, you can skip the
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
operations:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12709741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">DISABLE</span> <span class="token keyword">KEYS</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">ENABLE</span> <span class="token keyword">KEYS</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To speed up
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operations
that are performed with multiple statements for
nontransactional tables, lock your tables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70475638"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">LOCK</span> <span class="token keyword">TABLES</span> a <span class="token keyword">WRITE</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> a <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">23</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">34</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">33</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> a <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">26</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span><span class="token number">29</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This benefits performance because the index buffer is
flushed to disk only once, after all
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements have
completed. Normally, there would be as many index buffer
flushes as there are
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements. Explicit locking statements are not needed if
you can insert all rows with a single
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
.
</p>
<p>
Locking also lowers the total time for multiple-connection
tests, although the maximum wait time for individual
connections might go up because they wait for locks. Suppose
that five clients attempt to perform inserts simultaneously
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Connection 1 does 1000 inserts
</p>
</li>
<li class="listitem">
<p>
Connections 2, 3, and 4 do 1 insert
</p>
</li>
<li class="listitem">
<p>
Connection 5 does 1000 inserts
</p>
</li>
</ul>
</div>
<p>
If you do not use locking, connections 2, 3, and 4 finish
before 1 and 5. If you use locking, connections 2, 3, and 4
probably do not finish before 1 or 5, but the total time
should be about 40% faster.
</p>
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations are very
fast in MySQL, but you can obtain better overall performance
by adding locks around everything that does more than about
five successive inserts or updates. If you do very many
successive inserts, you could do a
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
followed by an
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
once in a while (each 1,000 rows or so) to
permit other threads to access table. This would still
result in a nice performance gain.
</p>
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
is still much slower
for loading data than
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
, even when using the strategies just
outlined.
</p>
</li>
<li class="listitem">
<p>
To increase performance for
<code class="literal">
MyISAM
</code>
tables, for both
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
and
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
, enlarge the key
cache by increasing the
<a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
<code class="literal">
key_buffer_size
</code>
</a>
system
variable. See
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stored-programs-logging.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="stored-programs-logging">
</a>
27.7 Stored Program Binary Logging
</h2>
</div>
</div>
</div>
<p>
The binary log contains information about SQL statements that
modify database contents. This information is stored in the form
of
<span class="quote">
“
<span class="quote">
events
</span>
”
</span>
that describe the modifications. (Binary
log events differ from scheduled event stored objects.) The binary
log has two important purposes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For replication, the binary log is used on source replication
servers as a record of the statements to be sent to replica
servers. The source sends the events contained in its binary
log to its replicas, which execute those events to make the
same data changes that were made on the source. See
<a class="xref" href="replication-implementation.html" title="19.2 Replication Implementation">
Section 19.2, “Replication Implementation”
</a>
.
</p>
</li>
<li class="listitem">
<p>
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
<a class="xref" href="recovery-from-backups.html" title="9.3.2 Using Backups for Recovery">
Section 9.3.2, “Using Backups for Recovery”
</a>
.
</p>
</li>
</ul>
</div>
<p>
However, if logging occurs at the statement level, there are
certain binary logging issues with respect to stored programs
(stored procedures and functions, triggers, and events):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
In some cases, a statement might affect different sets of rows
on source and replica.
</p>
</li>
<li class="listitem">
<p>
Replicated statements executed on a replica are processed by
the replica's applier thread. Unless you implement
replication privilege checks (see
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
), the applier
thread has full privileges. In this situation, it is possible
for a procedure to follow different execution paths on source
and replica servers, so a user could write a routine
containing a dangerous statement that executes only on the
replica.
</p>
</li>
<li class="listitem">
<p>
If a stored program that modifies data is nondeterministic, it
is not repeatable. This can result in different data on source
and replica, or cause restored data to differ from the
original data.
</p>
</li>
</ul>
</div>
<p>
This section describes how MySQL handles binary logging for stored
programs. It states the current conditions that the implementation
places on the use of stored programs, and what you can do to avoid
logging problems. It also provides additional information about
the reasons for these conditions.
</p>
<p>
Unless noted otherwise, the remarks here assume that binary
logging is enabled on the server (see
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
.) If the binary log is not enabled,
replication is not possible, nor is the binary log available for
data recovery. Binary logging is enabled by default, and is
disabled only if you start the server with
<a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
<code class="option">
--skip-log-bin
</code>
</a>
or
<a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
<code class="option">
--disable-log-bin
</code>
</a>
at startup.
</p>
<p>
In general, the issues described here result when binary logging
occurs at the SQL statement level (statement-based binary
logging). 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
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
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 replica side, only the row changes are
seen, not the stored program invocation.
</p>
<p>
Mixed format binary logging
(
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=MIXED
</code>
</a>
) uses
statement-based binary logging, except for cases where only
row-based binary logging is guaranteed to lead to proper results.
With mixed format, when a stored function, stored procedure,
trigger, event, or prepared statement contains anything that is
not safe for statement-based binary logging, the entire statement
is marked as unsafe and logged in row format. The statements used
to create and drop procedures, functions, triggers, and events are
always safe, and are logged in statement format. For more
information about row-based, mixed, and statement-based logging,
and how safe and unsafe statements are determined, see
<a class="xref" href="replication-formats.html" title="19.2.1 Replication Formats">
Section 19.2.1, “Replication Formats”
</a>
.
</p>
<p>
The conditions on the use of stored functions in MySQL 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.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To create or alter a stored function, you must have the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege, in
addition to the
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE ROUTINE
</code>
</a>
or
<a class="link" href="privileges-provided.html#priv_alter-routine">
<code class="literal">
ALTER ROUTINE
</code>
</a>
privilege that
is normally required. (Depending on the
<code class="literal">
DEFINER
</code>
value in the function definition,
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
might be
required regardless of whether binary logging is enabled. See
<a class="xref" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
Section 15.1.17, “CREATE PROCEDURE and CREATE FUNCTION Statements”
</a>
.)
</p>
</li>
<li class="listitem">
<p>
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.
</p>
<p>
By default, for a
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE
FUNCTION
</code>
</a>
statement to be accepted, at least one of
<code class="literal">
DETERMINISTIC
</code>
,
<code class="literal">
NO SQL
</code>
,
or
<code class="literal">
READS SQL DATA
</code>
must be specified
explicitly. Otherwise an error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa11762485"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">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)</code></pre>
</div>
<p>
This function is deterministic (and does not modify data), so
it is safe:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30232769"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> f1<span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">DETERMINISTIC</span>
<span class="token keyword">READS</span> <span class="token keyword">SQL</span> <span class="token keyword">DATA</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">RETURN</span> i<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This function uses
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
,
which is not deterministic, so the function also is not
deterministic and is not safe:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9731082"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> f2<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">36</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4
<span class="token keyword">BEGIN</span>
<span class="token keyword">RETURN</span> <span class="token function">UUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This function modifies data, so it may not be safe:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90358683"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> f3<span class="token punctuation">(</span>p_id <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> modtime <span class="token operator">=</span> <span class="token function">NOW</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">WHERE</span> id <span class="token operator">=</span> p_id<span class="token punctuation">;</span>
<span class="token keyword">RETURN</span> <span class="token function">ROW_COUNT</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Assessment of the nature of a function is based on the
<span class="quote">
“
<span class="quote">
honesty
</span>
”
</span>
of the creator. MySQL does not check
that a function declared
<code class="literal">
DETERMINISTIC
</code>
is
free of statements that produce nondeterministic results.
</p>
</li>
<li class="listitem">
<p>
When you attempt to execute a stored function, if
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=STATEMENT
</code>
</a>
is
set, the
<code class="literal">
DETERMINISTIC
</code>
keyword must be
specified in the function definition. If this is not the case,
an error is generated and the function does not run, unless
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators=1
</code>
</a>
is specified to override this check (see below). For recursive
function calls, the
<code class="literal">
DETERMINISTIC
</code>
keyword
is required on the outermost call only. If row-based or mixed
binary logging is in use, the statement is accepted and
replicated even if the function was defined without the
<code class="literal">
DETERMINISTIC
</code>
keyword.
</p>
</li>
<li class="listitem">
<p>
Because MySQL does not check if a function really is
deterministic at creation time, the invocation of a stored
function with the
<code class="literal">
DETERMINISTIC
</code>
keyword
might carry out an action that is unsafe for statement-based
logging, or invoke a function or procedure containing unsafe
statements. If this occurs when
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=STATEMENT
</code>
</a>
is
set, a warning message is issued. If row-based or mixed binary
logging is in use, no warning is issued, and the statement is
replicated in row-based format.
</p>
</li>
<li class="listitem">
<p>
To relax the preceding conditions on function creation (that
you must have the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege and that a function must be declared deterministic
or to not modify data), set the global
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators
</code>
</a>
system variable to 1. By default, this variable has a value of
0, but you can change it like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa66781442"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_bin_trust_function_creators <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can also set this variable at server startup.
</p>
<p>
If binary logging is not enabled,
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators
</code>
</a>
does not apply.
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
is not
required for function creation unless, as described
previously, the
<code class="literal">
DEFINER
</code>
value in the
function definition requires it.
</p>
</li>
<li class="listitem">
<p>
For information about built-in functions that may be unsafe
for replication (and thus cause stored functions that use them
to be unsafe as well), see
<a class="xref" href="replication-features.html" title="19.5.1 Replication Features and Issues">
Section 19.5.1, “Replication Features and Issues”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Triggers are similar to stored functions, so the preceding remarks
regarding functions also apply to triggers with the following
exception:
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
does not
have an optional
<code class="literal">
DETERMINISTIC
</code>
characteristic,
so triggers are assumed to be always deterministic. However, this
assumption might be invalid in some cases. For example, the
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
function is nondeterministic
(and does not replicate). Be careful about using such functions in
triggers.
</p>
<p>
Triggers can update tables, so error messages similar to those for
stored functions occur with
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE
TRIGGER
</code>
</a>
if you do not have the required privileges. On
the replica side, the replica uses the trigger
<code class="literal">
DEFINER
</code>
attribute to determine which user is
considered to be the creator of the trigger.
</p>
<p>
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:
<code class="literal">
CREATE
</code>
and
<code class="literal">
DROP
</code>
statements
are logged as statements regardless of the logging mode.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The server writes
<a class="link" href="create-event.html" title="15.1.13 CREATE EVENT Statement">
<code class="literal">
CREATE EVENT
</code>
</a>
,
<a class="link" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
<code class="literal">
CREATE PROCEDURE
</code>
</a>
,
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
,
<a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
<code class="literal">
ALTER EVENT
</code>
</a>
,
<a class="link" href="alter-procedure.html" title="15.1.7 ALTER PROCEDURE Statement">
<code class="literal">
ALTER PROCEDURE
</code>
</a>
,
<a class="link" href="alter-function.html" title="15.1.4 ALTER FUNCTION Statement">
<code class="literal">
ALTER FUNCTION
</code>
</a>
,
<a class="link" href="drop-event.html" title="15.1.25 DROP EVENT Statement">
<code class="literal">
DROP EVENT
</code>
</a>
,
<a class="link" href="drop-procedure.html" title="15.1.29 DROP PROCEDURE and DROP FUNCTION Statements">
<code class="literal">
DROP PROCEDURE
</code>
</a>
, and
<a class="link" href="drop-function.html" title="15.1.26 DROP FUNCTION Statement">
<code class="literal">
DROP FUNCTION
</code>
</a>
statements to the
binary log.
</p>
</li>
<li class="listitem">
<p>
A stored function invocation is logged as a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
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
statements. For example,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements are not written to the binary log, but a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
might invoke a stored
function that makes changes. To handle this, a
<code class="literal">
SELECT
<em class="replaceable">
<code>
func_name
</code>
</em>
()
</code>
statement is
written to the binary log when the given function makes a
change. Suppose that the following statements are executed on
the source server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64774596"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> f1<span class="token punctuation">(</span>a <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">BEGIN</span>
<span class="token function">IF</span> <span class="token punctuation">(</span>a <span class="token operator"><</span> <span class="token number">3</span><span class="token punctuation">)</span> <span class="token keyword">THEN</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token keyword">RETURN</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>a <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> f1<span class="token punctuation">(</span>a<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
When the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement
executes, the function
<code class="literal">
f1()
</code>
is invoked
three times. Two of those invocations insert a row, and MySQL
logs a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement for
each of them. That is, MySQL writes the following statements
to the binary log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54642899"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> f1<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> f1<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The server also logs a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement for a stored function invocation when the function
invokes a stored procedure that causes an error. In this case,
the server writes the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement to the log along with the expected error code. On
the replica, if the same error occurs, that is the expected
result and replication continues. Otherwise, replication
stops.
</p>
</li>
<li class="listitem">
<p>
Logging stored function invocations rather than the statements
executed by a function has a security implication for
replication, which arises from two factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
It is possible for a function to follow different
execution paths on source and replica servers.
</p>
</li>
<li class="listitem">
<p>
Statements executed on a replica are processed by the
replica's applier thread. Unless you implement replication
privilege checks (see
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
), the
applier thread has full privileges.
</p>
</li>
</ul>
</div>
<p>
The implication is that although a user must have the
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE ROUTINE
</code>
</a>
privilege to
create a function, the user can write a function containing a
dangerous statement that executes only on the replica where it
is processed by a thread that has full privileges. For
example, if the source and replica servers have server ID
values of 1 and 2, respectively, a user on the source server
could create and invoke an unsafe function
<code class="literal">
unsafe_func()
</code>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42368773"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> unsafe_func <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token keyword">BEGIN</span>
<span class="token prompt"> -></span> <span class="token keyword">IF</span> <span class="token variable">@@server_id</span><span class="token operator">=</span><span class="token number">2</span> <span class="token keyword">THEN</span> <em class="replaceable">dangerous_statement</em><span class="token punctuation">;</span> <span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">RETURN</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token comment" spellcheck="true">//</span>
<span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span>unsafe_func<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
and
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements are written
to the binary log, so the replica executes them. Because the
replica's applier thread has full privileges, it executes the
dangerous statement. Thus, the function invocation has
different effects on the source and replica and is not
replication-safe.
</p>
<p>
To guard against this danger for servers that have binary
logging enabled, stored function creators must have the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege, in addition to
the usual
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE ROUTINE
</code>
</a>
privilege that is required. Similarly, to use
<a class="link" href="alter-function.html" title="15.1.4 ALTER FUNCTION Statement">
<code class="literal">
ALTER FUNCTION
</code>
</a>
, you must have
the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege in addition
to the
<a class="link" href="privileges-provided.html#priv_alter-routine">
<code class="literal">
ALTER ROUTINE
</code>
</a>
privilege.
Without the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege, an
error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa82060304"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">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)</code></pre>
</div>
<p>
If you do not want to require function creators to have the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege (for example,
if all users with the
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE
ROUTINE
</code>
</a>
privilege on your system are experienced
application developers), set the global
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators
</code>
</a>
system variable to 1. You can also set this variable at server
startup. If binary logging is not enabled,
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators
</code>
</a>
does not apply.
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
is not
required for function creation unless, as described
previously, the
<code class="literal">
DEFINER
</code>
value in the
function definition requires it.
</p>
</li>
<li class="listitem">
<p>
The use of replication privilege checks recommended regardless
of any choices you make about privileges for function
creators. Replication privilege checks can be set up to ensure
that only expected and relevant operations are authorized for
the replication channel. For instructions to do this, see
<a class="xref" href="replication-privilege-checks.html" title="19.3.3 Replication Privilege Checks">
Section 19.3.3, “Replication Privilege Checks”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If a function that performs updates is nondeterministic, it is
not repeatable. This can have two undesirable effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
It causes a replica to differ from the source.
</p>
</li>
<li class="listitem">
<p>
Restored data does not match the original data.
</p>
</li>
</ul>
</div>
<p>
To deal with these problems, MySQL enforces the following
requirement: On a source 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:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<code class="literal">
DETERMINISTIC
</code>
and
<code class="literal">
NOT
DETERMINISTIC
</code>
characteristics indicate whether a
function always produces the same result for given inputs.
The default is
<code class="literal">
NOT DETERMINISTIC
</code>
if
neither characteristic is given. To declare that a
function is deterministic, you must specify
<code class="literal">
DETERMINISTIC
</code>
explicitly.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
CONTAINS SQL
</code>
,
<code class="literal">
NO
SQL
</code>
,
<code class="literal">
READS SQL DATA
</code>
, and
<code class="literal">
MODIFIES SQL DATA
</code>
characteristics
provide information about whether the function reads or
writes data. Either
<code class="literal">
NO SQL
</code>
or
<code class="literal">
READS SQL DATA
</code>
indicates that a
function does not change data, but you must specify one of
these explicitly because the default is
<code class="literal">
CONTAINS
SQL
</code>
if no characteristic is given.
</p>
</li>
</ul>
</div>
<p>
By default, for a
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE
FUNCTION
</code>
</a>
statement to be accepted, at least one of
<code class="literal">
DETERMINISTIC
</code>
,
<code class="literal">
NO SQL
</code>
,
or
<code class="literal">
READS SQL DATA
</code>
must be specified
explicitly. Otherwise an error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa48931894"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">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)</code></pre>
</div>
<p>
If you set
<a class="link" href="replication-options-binary-log.html#sysvar_log_bin_trust_function_creators">
<code class="literal">
log_bin_trust_function_creators
</code>
</a>
to 1, the requirement that functions be deterministic or not
modify data is dropped.
</p>
</li>
<li class="listitem">
<p>
Stored procedure calls are logged at the statement level
rather than at the
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
level.
That is, the server does not log the
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
statement, it logs those
statements within the procedure that actually execute. As a
result, the same changes that occur on the source server also
occur on replicas. This prevents problems that could result
from a procedure having different execution paths on different
machines.
</p>
<p>
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 statement execution within procedures is
not quite the same as in nonprocedure context:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045081319760">
</a>
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 variable is replaced by this
construct for logging purposes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa50741401"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token function">NAME_CONST</span><span class="token punctuation">(</span><em class="replaceable">var_name</em><span class="token punctuation">,</span> <em class="replaceable">var_value</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
<em class="replaceable">
<code>
var_name
</code>
</em>
is the local variable
name, and
<em class="replaceable">
<code>
var_value
</code>
</em>
is a
constant indicating the value that the variable has at the
time the statement is logged.
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
has a value of
<em class="replaceable">
<code>
var_value
</code>
</em>
, and a
<span class="quote">
“
<span class="quote">
name
</span>
”
</span>
of
<em class="replaceable">
<code>
var_name
</code>
</em>
. Thus, if you invoke
this function directly, you get a result like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29365048"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">NAME_CONST</span><span class="token punctuation">(</span><span class="token string">'myname'</span><span class="token punctuation">,</span> <span class="token number">14</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> myname <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
enables a
logged standalone statement to be executed on a replica
with the same effect as the original statement that was
executed on the source within a stored procedure.
</p>
<p>
The use of
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
can
result in a problem for
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
... SELECT
</code>
</a>
statements when the source column
expressions refer to local variables. Converting these
references to
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
expressions can result in column names that are different
on the source and replica 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
<code class="literal">
myvar
</code>
has
a value of 1:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa85212137"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">SELECT</span> myvar<span class="token punctuation">;</span></code></pre>
</div>
<p>
This is rewritten as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa69061401"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">SELECT</span> <span class="token function">NAME_CONST</span><span class="token punctuation">(</span>myvar<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To ensure that the source and replica tables have the same
column names, write the statement like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10464233"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">SELECT</span> myvar <span class="token keyword">AS</span> myvar<span class="token punctuation">;</span></code></pre>
</div>
<p>
The rewritten statement becomes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa82588595"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">SELECT</span> <span class="token function">NAME_CONST</span><span class="token punctuation">(</span>myvar<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> myvar<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A statement to be logged might contain references to
user-defined variables. To handle this, MySQL writes a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement to the binary log to make sure that the variable
exists on the replica with the same value as on the
source. For example, if a statement refers to a variable
<code class="literal">
@my_var
</code>
, that statement is preceded in
the binary log by the following statement, where
<em class="replaceable">
<code>
value
</code>
</em>
is the value of
<code class="literal">
@my_var
</code>
on the source:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa36359258"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token variable">@my_var</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Procedure calls can occur within a committed or
rolled-back transaction. Transactional context is
accounted for so that the transactional 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
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
,
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
, and
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
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,
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
and
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
statements are
logged with the updates. 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:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
Updates to transactional tables are not logged.
</p>
</li>
<li class="listitem">
<p>
Updates to nontransactional tables are logged because
rollback does not cancel them.
</p>
</li>
<li class="listitem">
<p>
Updates to a mix of transactional and nontransactional
tables are logged surrounded by
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
and
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
so that replicas make the same changes and rollbacks
as on the source.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
A stored procedure call is
<span class="emphasis">
<em>
not
</em>
</span>
written to
the binary log at the statement level if the procedure is
invoked from within a stored function. 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
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
statement (if it occurs
within a statement that is not logged). For this reason, care
should be exercised in the use of stored functions that invoke
a procedure, even if the procedure is otherwise safe in
itself.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-general.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-general">
</a>
A.1 MySQL 8.4 FAQ: General
</h2>
</div>
</div>
</div>
<div class="qandaset">
<a name="idm46045056501904">
</a>
<dl>
<dt>
A.1.1.
<a href="faqs-general.html#faq-mysql-version-ga">
Which version of MySQL is production-ready (GA)?
</a>
</dt>
<dt>
A.1.2.
<a href="faqs-general.html#faq-mysql-why-8.0">
Why did MySQL version numbering skip versions 6 and 7 and go
straight to 8.0?
</a>
</dt>
<dt>
A.1.3.
<a href="faqs-general.html#faq-mysql-do-subqueries">
Can MySQL do subqueries?
</a>
</dt>
<dt>
A.1.4.
<a href="faqs-general.html#faq-mysql-do-multiple-iud">
Can MySQL perform multiple-table inserts, updates, and deletes?
</a>
</dt>
<dt>
A.1.5.
<a href="faqs-general.html#faq-mysql-have-sequences">
Does MySQL have Sequences?
</a>
</dt>
<dt>
A.1.6.
<a href="faqs-general.html#faq-mysql-have-now-fractions">
Does MySQL have a NOW() function
with fractions of seconds?
</a>
</dt>
<dt>
A.1.7.
<a href="faqs-general.html#faq-mysql-support-multi-core">
Does MySQL work with multi-core processors?
</a>
</dt>
<dt>
A.1.8.
<a href="faqs-general.html#faq-mysql-why-multiple-processes">
Why do I see multiple processes for mysqld?
</a>
</dt>
<dt>
A.1.9.
<a href="faqs-general.html#faq-mysql-have-acid-transactions">
Can MySQL perform ACID transactions?
</a>
</dt>
</dl>
<table border="0" style="width: 100%;">
<colgroup>
<col align="left" width="1%"/>
<col/>
</colgroup>
<tbody>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-version-ga">
</a>
<a name="idm46045056501136">
</a>
<p>
<b>
A.1.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Which version of MySQL is production-ready (GA)?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
MySQL 9.1, 8.4, and 8.0 are actively supported for production
use.
</p>
<p>
The MySQL 9 Innovation series began with the MySQL 9.0.0 release
on 01 July 2024.
</p>
<p>
The MySQL 8.4 LTS series began with the MySQL 8.4.0 release on
30 April 2024.
</p>
<p>
The MySQL 8 Innovation series began with the MySQL 8.1.0 release
on 18 July 2023. Active development ended on 2024-01-16 with the
MySQL 8.3.0 release.
</p>
<p>
MySQL 8.0 achieved General Availability (GA) status with MySQL
8.0.11, which was released for production use on 19 April 2018.
It became a bugfix series as of MySQL 8.0.34 with the
introduction of the
<a class="link" href="mysql-releases.html" title="1.3 MySQL Releases: Innovation and LTS">
Innovation
and LTS release model
</a>
.
</p>
<p>
MySQL 5.7 achieved General Availability (GA) status with MySQL
5.7.9, which was released for production use on 21 October 2015.
Active development for MySQL 5.7 ended on 25 October 2023 with
the MySQL 5.7.44 release.
</p>
<p>
MySQL 5.6 achieved General Availability (GA) status with MySQL
5.6.10, which was released for production use on 5 February
2013. Active development for MySQL 5.6 has ended.
</p>
<p>
MySQL 5.5 achieved General Availability (GA) status with MySQL
5.5.8, which was released for production use on 3 December 2010.
Active development for MySQL 5.5 has ended.
</p>
<p>
MySQL 5.1 achieved General Availability (GA) status with MySQL
5.1.30, which was released for production use on 14 November
2008. Active development for MySQL 5.1 has ended.
</p>
<p>
MySQL 5.0 achieved General Availability (GA) status with MySQL
5.0.15, which was released for production use on 19 October
2005. Active development for MySQL 5.0 has ended.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-why-8.0">
</a>
<a name="idm46045056492880">
</a>
<p>
<b>
A.1.2.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Why did MySQL version numbering skip versions 6 and 7 and go
straight to 8.0?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Due to the many new and important features we were introducing
in this MySQL version, we decided to start a fresh new series.
As the series numbers 6 and 7 had actually been used before by
MySQL, we went to 8.0.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-do-subqueries">
</a>
<a name="idm46045056490608">
</a>
<p>
<b>
A.1.3.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can MySQL do subqueries?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. See
<a class="xref" href="subqueries.html" title="15.2.15 Subqueries">
Section 15.2.15, “Subqueries”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-do-multiple-iud">
</a>
<a name="idm46045056487904">
</a>
<p>
<b>
A.1.4.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can MySQL perform multiple-table inserts, updates, and deletes?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. For the syntax required to perform multiple-table updates,
see
<a class="xref" href="update.html" title="15.2.17 UPDATE Statement">
Section 15.2.17, “UPDATE Statement”
</a>
; for that required to perform
multiple-table deletes, see
<a class="xref" href="delete.html" title="15.2.2 DELETE Statement">
Section 15.2.2, “DELETE Statement”
</a>
.
</p>
<p>
A multiple-table insert can be accomplished using a trigger
whose
<code class="literal">
FOR EACH ROW
</code>
clause contains multiple
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements within a
<code class="literal">
BEGIN ... END
</code>
block. See
<a class="xref" href="triggers.html" title="27.3 Using Triggers">
Section 27.3, “Using Triggers”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-sequences">
</a>
<a name="idm46045056480544">
</a>
<p>
<b>
A.1.5.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have Sequences?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
No. However, MySQL has an
<code class="literal">
AUTO_INCREMENT
</code>
system, which can also handle inserts in a multi-source
replication setup. With the
<a class="link" href="replication-options-source.html#sysvar_auto_increment_increment">
<code class="literal">
auto_increment_increment
</code>
</a>
and
<a class="link" href="replication-options-source.html#sysvar_auto_increment_offset">
<code class="literal">
auto_increment_offset
</code>
</a>
system
variables, you can set each server to generate auto-increment
values that don't conflict with other servers. The
<a class="link" href="replication-options-source.html#sysvar_auto_increment_increment">
<code class="literal">
auto_increment_increment
</code>
</a>
value
should be greater than the number of servers, and each server
should have a unique offset.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-now-fractions">
</a>
<a name="idm46045056473632">
</a>
<p>
<b>
A.1.6.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have a
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
function
with fractions of seconds?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes, see
<a class="xref" href="fractional-seconds.html" title="13.2.6 Fractional Seconds in Time Values">
Section 13.2.6, “Fractional Seconds in Time Values”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-support-multi-core">
</a>
<a name="idm46045056469760">
</a>
<p>
<b>
A.1.7.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL work with multi-core processors?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. MySQL is fully multithreaded, and makes use of all CPUs
made available to it. Not all CPUs may be available; modern
operating systems should be able to utilize all underlying CPUs,
but also make it possible to restrict a process to a specific
CPU or sets of CPUs.
</p>
<p>
On Windows, there is currently a limit to the number of
(logical) processors that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
can use: a
single processor group, which is limited to a maximum of 64
logical processors.
</p>
<p>
Use of multiple cores may be seen in these ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A single core is usually used to service the commands issued
from one session.
</p>
</li>
<li class="listitem">
<p>
A few background threads make limited use of extra cores;
for example, to keep background I/O tasks moving.
</p>
</li>
<li class="listitem">
<p>
If the database is I/O-bound (indicated by CPU consumption
less than capacity), adding more CPUs is futile. If the
database is partitioned into an I/O-bound part and a
CPU-bond part, adding CPUs may still be useful.
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-why-multiple-processes">
</a>
<a name="idm46045056461136">
</a>
<p>
<b>
A.1.8.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Why do I see multiple processes for
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is a single-process program, not a
multi-process program, and does not fork or launch other
processes. However,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is multithreaded
and some process-reporting system utilities display separate
entries for each thread of multithreaded processes, which may
lead to the appearance of multiple
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
processes when in fact there is only one.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-acid-transactions">
</a>
<a name="idm46045056453936">
</a>
<p>
<b>
A.1.9.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can MySQL perform ACID transactions?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. All current MySQL versions support transactions. The
<code class="literal">
InnoDB
</code>
storage engine offers full ACID
transactions with row-level locking, multi-versioning,
nonlocking repeatable reads, and all four SQL standard isolation
levels.
</p>
<p>
The
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine supports the
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
transaction
isolation level only.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-introduction.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-introduction">
</a>
17.1 Introduction to InnoDB
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-benefits.html">
17.1.1 Benefits of Using InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-best-practices.html">
17.1.2 Best Practices for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-check-availability.html">
17.1.3 Verifying that InnoDB is the Default Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-benchmarking.html">
17.1.4 Testing and Benchmarking with InnoDB
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045167491728">
</a>
<a class="indexterm" name="idm46045167490240">
</a>
<a class="indexterm" name="idm46045167489168">
</a>
<a class="indexterm" name="idm46045167487680">
</a>
<a class="indexterm" name="idm46045167486608">
</a>
<a class="indexterm" name="idm46045167485120">
</a>
<a class="indexterm" name="idm46045167484048">
</a>
<a class="indexterm" name="idm46045167482976">
</a>
<a class="indexterm" name="idm46045167481904">
</a>
<p>
<code class="literal">
InnoDB
</code>
is a general-purpose storage engine that
balances high reliability and high performance. In MySQL
8.4,
<code class="literal">
InnoDB
</code>
is the default MySQL
storage engine. Unless you have configured a different default
storage engine, issuing a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statement without an
<code class="literal">
ENGINE
</code>
clause creates an
<code class="literal">
InnoDB
</code>
table.
</p>
<h3>
<a name="innodb-key-advantages">
</a>
Key Advantages of InnoDB
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Its DML operations follow the ACID model, with transactions
featuring commit, rollback, and crash-recovery capabilities to
protect user data. See
<a class="xref" href="mysql-acid.html" title="17.2 InnoDB and the ACID Model">
Section 17.2, “InnoDB and the ACID Model”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Row-level locking and Oracle-style consistent reads increase
multi-user concurrency and performance. See
<a class="xref" href="innodb-locking-transaction-model.html" title="17.7 InnoDB Locking and Transaction Model">
Section 17.7, “InnoDB Locking and Transaction Model”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
tables arrange your data on disk to
optimize queries based on primary keys. Each
<code class="literal">
InnoDB
</code>
table has a primary key index called
the clustered index that organizes the data to minimize I/O for
primary key lookups. See
<a class="xref" href="innodb-index-types.html" title="17.6.2.1 Clustered and Secondary Indexes">
Section 17.6.2.1, “Clustered and Secondary Indexes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
To maintain data integrity,
<code class="literal">
InnoDB
</code>
supports
<code class="literal">
FOREIGN KEY
</code>
constraints. With foreign keys,
inserts, updates, and deletes are checked to ensure they do not
result in inconsistencies across related tables. See
<a class="xref" href="create-table-foreign-keys.html" title="15.1.20.5 FOREIGN KEY Constraints">
Section 15.1.20.5, “FOREIGN KEY Constraints”
</a>
.
</p>
</li>
</ul>
</div>
<div class="table">
<a name="idm46045167464704">
</a>
<p class="title">
<b>
Table 17.1 InnoDB Storage Engine Features
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Features supported by the InnoDB storage engine.">
<colgroup>
<col style="width: 60%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th>
Feature
</th>
<th>
Support
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="bold">
<strong>
B-tree indexes
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Backup/point-in-time recovery
</strong>
</span>
(Implemented in the server, rather than in the storage engine.)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Cluster database support
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Clustered indexes
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Compressed data
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Data caches
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Encrypted data
</strong>
</span>
</td>
<td>
Yes (Implemented in the server via encryption functions; In MySQL 5.7 and later, data-at-rest encryption is supported.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Foreign key support
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Full-text search indexes
</strong>
</span>
</td>
<td>
Yes (Support for FULLTEXT indexes is available in MySQL 5.6 and later.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Geospatial data type support
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Geospatial indexing support
</strong>
</span>
</td>
<td>
Yes (Support for geospatial indexing is available in MySQL 5.7 and later.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Hash indexes
</strong>
</span>
</td>
<td>
No (InnoDB utilizes hash indexes internally for its Adaptive Hash Index feature.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Index caches
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Locking granularity
</strong>
</span>
</td>
<td>
Row
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
MVCC
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Replication support
</strong>
</span>
(Implemented in the server, rather than in the storage engine.)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Storage limits
</strong>
</span>
</td>
<td>
64TB
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
T-tree indexes
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Transactions
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Update statistics for data dictionary
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 442.797px;">
Feature
</th>
<th style="width: 295.203px;">
Support
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
To compare the features of
<code class="literal">
InnoDB
</code>
with other
storage engines provided with MySQL, see the
<span class="emphasis">
<em>
Storage
Engine Features
</em>
</span>
table in
<a class="xref" href="storage-engines.html" title="Chapter 18 Alternative Storage Engines">
Chapter 18,
<i>
Alternative Storage Engines
</i>
</a>
.
</p>
<h3>
<a name="innodb-enhancements">
</a>
InnoDB Enhancements and New Features
</h3>
<p>
For information about
<code class="literal">
InnoDB
</code>
enhancements and new
features, refer to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
InnoDB
</code>
enhancements list in
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
Release
Notes
</a>
.
</p>
</li>
</ul>
</div>
<h3>
<a name="innodb-additional-resources">
</a>
Additional InnoDB Information and Resources
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<code class="literal">
InnoDB
</code>
-related terms and definitions, see
the
<a class="xref" href="glossary.html" title="MySQL Glossary">
MySQL Glossary
</a>
.
</p>
</li>
<li class="listitem">
<p>
For a forum dedicated to the
<code class="literal">
InnoDB
</code>
storage
engine, see
<a class="ulink" href="http://forums.mysql.com/list.php?22" target="_blank">
MySQL
Forums::InnoDB
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
is published under the same GNU GPL
License Version 2 (of June 1991) as MySQL. For more information
on MySQL licensing, see
<a class="ulink" href="http://www.mysql.com/company/legal/licensing/" target="_blank">
http://www.mysql.com/company/legal/licensing/
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/firewall-usage.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="firewall-usage">
</a>
8.4.7.3 Using MySQL Enterprise Firewall
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045234526736">
</a>
<p>
Before using MySQL Enterprise Firewall, install it according to the instructions
provided in
<a class="xref" href="firewall-installation.html" title="8.4.7.2 Installing or Uninstalling MySQL Enterprise Firewall">
Section 8.4.7.2, “Installing or Uninstalling MySQL Enterprise Firewall”
</a>
.
</p>
<p>
This section describes how to configure MySQL Enterprise Firewall using SQL
statements. Alternatively, MySQL Workbench 6.3.4 or higher provides
a graphical interface for firewall control. See
<a class="ulink" href="/doc/workbench/en/wb-mysql-firewall.html" target="_top">
MySQL Enterprise Firewall Interface
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-enabling-disabling" title="Enabling or Disabling the Firewall">
Enabling or Disabling the Firewall
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-schedule-reloads" title="Scheduling Firewall Cache Reloads">
Scheduling Firewall Cache Reloads
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-privileges" title="Assigning Firewall Privileges">
Assigning Firewall Privileges
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-concepts" title="Firewall Concepts">
Firewall Concepts
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-group-profiles" title="Registering Firewall Group Profiles">
Registering Firewall Group Profiles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-account-profiles" title="Registering Firewall Account Profiles">
Registering Firewall Account Profiles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-monitoring" title="Monitoring the Firewall">
Monitoring the Firewall
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-account-profile-migration" title="Migrating Account Profiles to Group Profiles">
Migrating Account Profiles to Group Profiles
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-enabling-disabling">
</a>
Enabling or Disabling the Firewall
</h5>
</div>
</div>
</div>
<p>
To enable or disable the firewall, set the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_mode">
<code class="literal">
mysql_firewall_mode
</code>
</a>
system
variable. By default, this variable is enabled when the
firewall is installed. To control the initial firewall state
explicitly, you can set the variable at server startup. For
example, to enable the firewall in an option file, use these
lines:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa17910707"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">mysql_firewall_mode</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span></code></pre>
</div>
<p>
After modifying
<code class="filename">
my.cnf
</code>
, restart the
server to cause the new setting to take effect.
</p>
<p>
Alternatively, to set and persist the firewall setting at
runtime:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8880229"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> mysql_firewall_mode <span class="token operator">=</span> <span class="token keyword">OFF</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> mysql_firewall_mode <span class="token operator">=</span> <span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
PERSIST
</code>
</a>
sets a value for the running MySQL instance.
It also saves the value, causing it to carry over to
subsequent server restarts. To change a value for the running
MySQL instance without having it carry over to subsequent
restarts, use the
<code class="literal">
GLOBAL
</code>
keyword rather
than
<code class="literal">
PERSIST
</code>
. See
<a class="xref" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
Section 15.7.6.1, “SET Syntax for Variable Assignment”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-schedule-reloads">
</a>
Scheduling Firewall Cache Reloads
</h5>
</div>
</div>
</div>
<p>
Each time the
<code class="literal">
MYSQL_FIREWALL
</code>
server-side
plugin initializes, it loads data from these tables to its
internal cache:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
firewall_whitelist
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
firewall_group_allowlist
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
firewall_users
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
firewall_groups
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
firewall_membership
</code>
</p>
</li>
</ul>
</div>
<p>
Without restarting the server or reinstalling the server-side
plugin, modification of data outside of the plugin is not
reflected internally. The
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_reload_interval_seconds">
<code class="literal">
mysql_firewall_reload_interval_seconds
</code>
</a>
system variable makes it possible to force memory cache
reloads from tables at specified intervals. By default, the
periodic interval value is set to zero, which disables
reloads.
</p>
<p>
To schedule regular cache reloads, first ensure that the
<code class="literal">
scheduler
</code>
component is installed and
enabled (see
<a class="xref" href="scheduler-component.html" title="7.5.5 Scheduler Component">
Section 7.5.5, “Scheduler Component”
</a>
). To check
the status of the component:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78135240"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'component_scheduler%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token operator">+</span><span class="token comment" spellcheck="true">-----------------------------+-------|</span>
<span class="token output"><span class="token punctuation">|</span> component_scheduler.enabled <span class="token punctuation">|</span> On <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
With the firewall installed, set the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_reload_interval_seconds">
<code class="literal">
mysql_firewall_reload_interval_seconds
</code>
</a>
global system variable at server startup to a number between
60 and the INT_MAX macro value of the platform hosting the
server. Values between zero and 60 (1 through 59) reset to 60.
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa14313102"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqld</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">[</span>server-options<span class="token punctuation">]</span></em><span class="token punctuation"></span> <span class="token constant">--mysql-firewall-reload-interval-seconds</span><span class="token attr-value"><span class="token punctuation">=</span>40</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
2023-08-31T17<span class="token punctuation">:</span>46<span class="token punctuation">:</span>35<span class="token punctuation">.</span>043468Z 0 <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> <span class="token punctuation">[</span>MY-015031<span class="token punctuation">]</span> <span class="token punctuation">[</span>Server<span class="token punctuation">]</span> Plugin MYSQL_FIREWALL
reported<span class="token punctuation">:</span> 'Invalid reload interval specified<span class="token punctuation">:</span> 40<span class="token punctuation">.</span> Valid values are 0 <span class="token punctuation">(</span>off<span class="token punctuation">)</span> or
greater than or equal to 60<span class="token punctuation">.</span> Adjusting to 60<span class="token punctuation">.</span>'
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
Alternatively, to set and persist the firewall setting at
startup, precede the read-only variable name by the
<code class="literal">
PERSIST_ONLY
</code>
keyword or the
<code class="literal">
@@PERSIST_ONLY.
</code>
qualifier:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30043133"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">PERSIST_ONLY</span> mysql_firewall_reload_interval_seconds <span class="token operator">=</span> <span class="token number">120</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@PERSIST_ONLY.mysql_firewall_reload_interval_seconds</span> <span class="token operator">=</span> <span class="token number">120</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
After modifying the variable, restart the server to cause the
new setting to take effect.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-privileges">
</a>
Assigning Firewall Privileges
</h5>
</div>
</div>
</div>
<p>
With the firewall installed, grant the appropriate privileges
to the MySQL account or accounts to be used for administering
it. The privileges depend on which firewall operations an
account should be permitted to perform:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Grant the
<a class="link" href="privileges-provided.html#priv_firewall-exempt">
<code class="literal">
FIREWALL_EXEMPT
</code>
</a>
privilege to any account that should be exempt from
firewall restrictions. This is useful, for example, for a
database administrator who configures the firewall, to
avoid the possibility of a misconfiguration causing even
the administrator to be locked out and unable to execute
statements.
</p>
</li>
<li class="listitem">
<p>
Grant the
<a class="link" href="privileges-provided.html#priv_firewall-admin">
<code class="literal">
FIREWALL_ADMIN
</code>
</a>
privilege to any account that should have full
administrative firewall access. (Some administrative
firewall functions can be invoked by accounts that have
<a class="link" href="privileges-provided.html#priv_firewall-admin">
<code class="literal">
FIREWALL_ADMIN
</code>
</a>
<span class="emphasis">
<em>
or
</em>
</span>
the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege, as
indicated in the individual function descriptions.)
</p>
</li>
<li class="listitem">
<p>
Grant the
<a class="link" href="privileges-provided.html#priv_firewall-user">
<code class="literal">
FIREWALL_USER
</code>
</a>
privilege to any account that should have administrative
access only for its own firewall rules.
</p>
</li>
<li class="listitem">
<p>
Grant the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege
for the firewall stored procedures in the firewall
database. These may invoke administrative functions, so
stored procedure access also requires the privileges
indicated earlier that are needed for those functions. The
firewall database can be the
<code class="literal">
mysql
</code>
system database or a custom schema (see
<a class="xref" href="firewall-installation.html#firewall-install" title="Installing MySQL Enterprise Firewall">
Installing MySQL Enterprise Firewall
</a>
).
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="privileges-provided.html#priv_firewall-exempt">
<code class="literal">
FIREWALL_EXEMPT
</code>
</a>
,
<a class="link" href="privileges-provided.html#priv_firewall-admin">
<code class="literal">
FIREWALL_ADMIN
</code>
</a>
, and
<a class="link" href="privileges-provided.html#priv_firewall-user">
<code class="literal">
FIREWALL_USER
</code>
</a>
privileges can
be granted only while the firewall is installed because the
<code class="literal">
MYSQL_FIREWALL
</code>
plugin defines those
privileges.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-concepts">
</a>
Firewall Concepts
</h5>
</div>
</div>
</div>
<p>
The MySQL server permits clients to connect and receives from
them SQL statements to be executed. If the firewall is
enabled, the server passes to it each incoming statement that
does not immediately fail with a syntax error. Based on
whether the firewall accepts the statement, the server
executes it or returns an error to the client. This section
describes how the firewall accomplishes the task of accepting
or rejecting statements.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-profiles" title="Firewall Profiles">
Firewall Profiles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-statement-matching" title="Firewall Statement Matching">
Firewall Statement Matching
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-profile-modes" title="Profile Operational Modes">
Profile Operational Modes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="firewall-usage.html#firewall-multiple-profiles" title="Firewall Statement Handling When Multiple Profiles Apply">
Firewall Statement Handling When Multiple Profiles Apply
</a>
</p>
</li>
</ul>
</div>
<h6>
<a name="firewall-profiles">
</a>
Firewall Profiles
</h6>
<p>
The firewall uses a registry of profiles that determine
whether to permit statement execution. Profiles have these
attributes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An allowlist. The allowlist is the set of rules that
defines which statements are acceptable to the profile.
</p>
</li>
<li class="listitem">
<p>
A current operational mode. The mode enables the profile
to be used in different ways. For example: the profile can
be placed in training mode to establish the allowlist; the
allowlist can be used for restricting statement execution
or intrusion detection; the profile can be disabled
entirely.
</p>
</li>
<li class="listitem">
<p>
A scope of applicability. The scope indicates which client
connections the profile applies to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The firewall supports account-based profiles such that
each profile matches a particular client account
(client user name and host name combination). For
example, you can register one account profile for
which the allowlist applies to connections originating
from
<code class="literal">
admin@localhost
</code>
and another
account profile for which the allowlist applies to
connections originating from
<code class="literal">
[email protected]
</code>
.
</p>
</li>
<li class="listitem">
<p>
The firewall supports group profiles that can have
multiple accounts as members, with the profile
allowlist applying equally to all members. Group
profiles enable easier administration and greater
flexibility for deployments that require applying a
given set of allowlist rules to multiple accounts.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
Initially, no profiles exist, so by default, the firewall
accepts all statements and has no effect on which statements
MySQL accounts can execute. To apply firewall protective
capabilities, explicit action is required:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Register one or more profiles with the firewall.
</p>
</li>
<li class="listitem">
<p>
Train the firewall by establishing the allowlist for each
profile; that is, the types of statements the profile
permits clients to execute.
</p>
</li>
<li class="listitem">
<p>
Place the trained profiles in protecting mode to harden
MySQL against unauthorized statement execution:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
MySQL associates each client session with a specific
user name and host name combination. This combination
is the
<span class="emphasis">
<em>
session account
</em>
</span>
.
</p>
</li>
<li class="listitem">
<p>
For each client connection, the firewall uses the
session account to determine which profiles apply to
handling incoming statements from the client.
</p>
<p>
The firewall accepts only statements permitted by the
applicable profile allowlists.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
Most firewall principles apply identically to group profiles
and account profiles. The two types of profiles differ in
these respects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An account profile allowlist applies only to a single
account. A group profile allowlist applies when the
session account matches any account that is a member of
the group.
</p>
</li>
<li class="listitem">
<p>
To apply an allowlist to multiple accounts using account
profiles, it is necessary to register one profile per
account and duplicate the allowlist across each profile.
This entails training each account profile individually
because each one must be trained using the single account
to which it applies.
</p>
<p>
A group profile allowlist applies to multiple accounts,
with no need to duplicate it for each account. A group
profile can be trained using any or all of the group
member accounts, or training can be limited to any single
member. Either way, the allowlist applies to all members.
</p>
</li>
<li class="listitem">
<p>
Account profile names are based on specific user name and
host name combinations that depend on which clients
connect to the MySQL server. Group profile names are
chosen by the firewall administrator with no constraints
other than that their length must be from 1 to 288
characters.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Due to the advantages of group profiles over account
profiles, and because a group profile with a single member
account is logically equivalent to an account profile for
that account, it is recommended that all new firewall
profiles be created as group profiles. Account profiles are
deprecated, and subject to removal in a future MySQL
version. For assistance converting existing account
profiles, see
<a class="xref" href="firewall-usage.html#firewall-account-profile-migration" title="Migrating Account Profiles to Group Profiles">
Migrating Account Profiles to Group Profiles
</a>
.
</p>
</div>
<p>
The profile-based protection afforded by the firewall enables
implementation of strategies such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If an application has unique protection requirements,
configure it to use an account not used for any other
purpose and set up a group profile or account profile for
that account.
</p>
</li>
<li class="listitem">
<p>
If related applications share protection requirements,
associate each application with its own account, then add
these application accounts as members of the same group
profile. Alternatively, configure all the applications to
use the same account and associate them with an account
profile for that account.
</p>
</li>
</ul>
</div>
<h6>
<a name="firewall-statement-matching">
</a>
Firewall Statement Matching
</h6>
<p>
Statement matching performed by the firewall does not use SQL
statements as received from clients. Instead, the server
converts incoming statements to normalized digest form and
firewall operation uses these digests. The benefit of
statement normalization is that it enables similar statements
to be grouped and recognized using a single pattern. For
example, these statements are distinct from each other:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66737244"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">FROM</span> customer <span class="token keyword">WHERE</span> customer_id <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">select</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">from</span> customer <span class="token keyword">where</span> customer_id <span class="token operator">=</span> <span class="token number">99</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">FROM</span> customer <span class="token keyword">WHERE</span> customer_id <span class="token operator">=</span> <span class="token number">143</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
But all of them have the same normalized digest form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35684905"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token punctuation">`</span>first_name<span class="token punctuation">`</span> <span class="token punctuation">,</span> <span class="token punctuation">`</span>last_name<span class="token punctuation">`</span> <span class="token keyword">FROM</span> <span class="token punctuation">`</span>customer<span class="token punctuation">`</span> <span class="token keyword">WHERE</span> <span class="token punctuation">`</span>customer_id<span class="token punctuation">`</span> <span class="token operator">=</span> ?</code></pre>
</div>
<p>
By using normalization, firewall allowlists can store digests
that each match many different statements received from
clients. For more information about normalization and digests,
see
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Setting the
<a class="link" href="server-system-variables.html#sysvar_max_digest_length">
<code class="literal">
max_digest_length
</code>
</a>
system
variable to zero disables digest production, which also
disables server functionality that requires digests, such as
MySQL Enterprise Firewall.
</p>
</div>
<h6>
<a name="firewall-profile-modes">
</a>
Profile Operational Modes
</h6>
<p>
Each profile registered with the firewall has its own
operational mode, chosen from these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
OFF
</code>
: This mode disables the profile.
The firewall considers it inactive and ignores it.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RECORDING
</code>
: This is the firewall
training mode. Incoming statements received from a client
that matches the profile are considered acceptable for the
profile and become part of its
<span class="quote">
“
<span class="quote">
fingerprint.
</span>
”
</span>
The firewall records the normalized digest form of each
statement to learn the acceptable statement patterns for
the profile. Each pattern is a rule, and the union of the
rules is the profile allowlist.
</p>
<p>
A difference between group and account profiles is that
statement recording for a group profile can be limited to
statements received from a single group member (the
training member).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PROTECTING
</code>
: In this mode, the profile
allows or prevents statement execution. The firewall
matches incoming statements against the profile allowlist,
accepting only statements that match and rejecting those
that do not. After training a profile in
<code class="literal">
RECORDING
</code>
mode, switch it to
<code class="literal">
PROTECTING
</code>
mode to harden MySQL against
access by statements that deviate from the allowlist. If
the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_trace">
<code class="literal">
mysql_firewall_trace
</code>
</a>
system variable is enabled, the firewall also writes
rejected statements to the error log.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DETECTING
</code>
: This mode detects but not
does not block intrusions (statements that are suspicious
because they match nothing in the profile allowlist). In
<code class="literal">
DETECTING
</code>
mode, the firewall writes
suspicious statements to the error log but accepts them
without denying access.
</p>
</li>
</ul>
</div>
<p>
When a profile is assigned any of the preceding mode values,
the firewall stores the mode in the profile. Firewall
mode-setting operations also permit a mode value of
<code class="literal">
RESET
</code>
, but this value is not stored:
setting a profile to
<code class="literal">
RESET
</code>
mode causes the
firewall to delete all rules for the profile and set its mode
to
<code class="literal">
OFF
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Messages written to the error log in
<code class="literal">
DETECTING
</code>
mode or because
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_trace">
<code class="literal">
mysql_firewall_trace
</code>
</a>
is
enabled are written as Notes, which are information
messages. To ensure that such messages appear in the error
log and are not discarded, make sure that error-logging
verbosity is sufficient to include information messages. For
example, if you are using priority-based log filtering, as
described in
<a class="xref" href="error-log-priority-based-filtering.html" title="7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)">
Section 7.4.2.5, “Priority-Based Error Log Filtering (log_filter_internal)”
</a>
, set
the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
system variable to a value of 3.
</p>
</div>
<h6>
<a name="firewall-multiple-profiles">
</a>
Firewall Statement Handling When Multiple Profiles Apply
</h6>
<p>
For simplicity, later sections that describe how to set up
profiles take the perspective that the firewall matches
incoming statements from a client against only a single
profile, either a group profile or account profile. But
firewall operation can be more complex:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A group profile can include multiple accounts as members.
</p>
</li>
<li class="listitem">
<p>
An account can be a member of multiple group profiles.
</p>
</li>
<li class="listitem">
<p>
Multiple profiles can match a given client.
</p>
</li>
</ul>
</div>
<p>
The following description covers the general case of how the
firewall operates, when potentially multiple profiles apply to
incoming statements.
</p>
<p>
As previously mentioned, MySQL associates each client session
with a specific user name and host name combination known as
the
<span class="emphasis">
<em>
session account
</em>
</span>
. The firewall matches
the session account against registered profiles to determine
which profiles apply to handling incoming statements from the
session:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The firewall ignores inactive profiles (profiles with a
mode of
<code class="literal">
OFF
</code>
).
</p>
</li>
<li class="listitem">
<p>
The session account matches every active group profile
that includes a member having the same user and host.
There can be more than one such group profile.
</p>
</li>
<li class="listitem">
<p>
The session account matches an active account profile
having the same user and host, if there is one. There is
at most one such account profile.
</p>
</li>
</ul>
</div>
<p>
In other words, the session account can match 0 or more active
group profiles, and 0 or 1 active account profiles. This means
that 0, 1, or multiple firewall profiles are applicable to a
given session, for which the firewall handles each incoming
statement as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If there is no applicable profile, the firewall imposes no
restrictions and accepts the statement.
</p>
</li>
<li class="listitem">
<p>
If there are applicable profiles, their modes determine
statement handling:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The firewall records the statement in the allowlist of
each applicable profile that is in
<code class="literal">
RECORDING
</code>
mode.
</p>
</li>
<li class="listitem">
<p>
The firewall writes the statement to the error log for
each applicable profile in
<code class="literal">
DETECTING
</code>
mode for which the
statement is suspicious (does not match the profile
allowlist).
</p>
</li>
<li class="listitem">
<p>
The firewall accepts the statement if at least one
applicable profile is in
<code class="literal">
RECORDING
</code>
or
<code class="literal">
DETECTING
</code>
mode (those modes
accept all statements), or if the statement matches
the allowlist of at least one applicable profile in
<code class="literal">
PROTECTING
</code>
mode. Otherwise, the
firewall rejects the statement (and writes it to the
error log if the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_trace">
<code class="literal">
mysql_firewall_trace
</code>
</a>
system variable is enabled).
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
With that description in mind, the next sections revert to the
simplicity of the situations when a single group profile or a
single account profile apply, and cover how to set up each
type of profile.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-group-profiles">
</a>
Registering Firewall Group Profiles
</h5>
</div>
</div>
</div>
<p>
MySQL Enterprise Firewall supports registration of group profiles. A group
profile can have multiple accounts as its members. To use a
firewall group profile to protect MySQL against incoming
statements from a given account, follow these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Register the group profile and put it in
<code class="literal">
RECORDING
</code>
mode.
</p>
</li>
<li class="listitem">
<p>
Add a member account to the group profile.
</p>
</li>
<li class="listitem">
<p>
Connect to the MySQL server using the member account and
execute statements to be learned. This trains the group
profile and establishes the rules that form the profile
allowlist.
</p>
</li>
<li class="listitem">
<p>
Add to the group profile any other accounts that are to be
group members.
</p>
</li>
<li class="listitem">
<p>
Switch the group profile to
<code class="literal">
PROTECTING
</code>
mode. When a client connects to the server using any
account that is a member of the group profile, the profile
allowlist restricts statement execution.
</p>
</li>
<li class="listitem">
<p>
Should additional training be necessary, switch the group
profile to
<code class="literal">
RECORDING
</code>
mode again, update
its allowlist with new statement patterns, then switch it
back to
<code class="literal">
PROTECTING
</code>
mode.
</p>
</li>
</ol>
</div>
<p>
Observe these guidelines for firewall-related account
references:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Take note of the context in which account references
occur. To name an account for firewall operations, specify
it as a single quoted string
(
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
@
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
).
This differs from the usual MySQL convention for
statements such as
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE
USER
</code>
</a>
and
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
,
for which you quote the user and host parts of an account
name separately
(
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
'@'
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
).
</p>
<p>
The requirement for naming accounts as a single quoted
string for firewall operations means that you cannot use
accounts that have embedded
<code class="literal">
@
</code>
characters in the user name.
</p>
</li>
<li class="listitem">
<p>
The firewall assesses statements against accounts
represented by actual user and host names as authenticated
by the server. When registering accounts in profiles, do
not use wildcard characters or netmasks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Suppose that an account named
<code class="literal">
me@%.example.org
</code>
exists and a
client uses it to connect to the server from the host
<code class="literal">
abc.example.org
</code>
.
</p>
</li>
<li class="listitem">
<p>
The account name contains a
<code class="literal">
%
</code>
wildcard character, but the server authenticates the
client as having a user name of
<code class="literal">
me
</code>
and host name of
<code class="literal">
abc.example.com
</code>
,
and that is what the firewall sees.
</p>
</li>
<li class="listitem">
<p>
Consequently, the account name to use for firewall
operations is
<code class="literal">
[email protected]
</code>
rather than
<code class="literal">
me@%.example.org
</code>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
The following procedure shows how to register a group profile
with the firewall, train the firewall to know the acceptable
statements for that profile (its allowlist), use the profile
to protect MySQL against execution of unacceptable statements,
and add and remove group members. The example uses a group
profile name of
<code class="literal">
fwgrp
</code>
. The example profile
is presumed for use by clients of an application that accesses
tables in the
<code class="literal">
sakila
</code>
database (available at
<a class="ulink" href="/doc/index-other.html" target="_top">
https://dev.mysql.com/doc/index-other.html
</a>
).
</p>
<p>
Use an administrative MySQL account to perform the steps in
this procedure, except those steps designated for execution by
member accounts of the firewall group profile. For statements
executed by member accounts, the default database should be
<code class="literal">
sakila
</code>
. (You can use a different database
by adjusting the instructions accordingly.)
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
If necessary, create the accounts that are to be members
of the
<code class="literal">
fwgrp
</code>
group profile and grant
them appropriate access privileges. Statements for one
member are shown here (choose an appropriate password):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49074430"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'member1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> sakila<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'member1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
sp_set_firewall_group_mode()
</code>
stored procedure to register the group profile with the
firewall and place the profile in
<code class="literal">
RECORDING
</code>
(training) mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa77350723"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you have installed MySQL Enterprise Firewall in a custom schema, then
make appropriate substitution for your system. For
example, if the firewall is installed in the
<code class="literal">
fwdb
</code>
schema, then execute the stored
procedures like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa62237038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> fwdb<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
</p>
</div>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
sp_firewall_group_enlist()
</code>
stored procedure to add an initial member account for use
in training the group profile allowlist:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa18416518"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_firewall_group_enlist<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'member1@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To train the group profile using the initial member
account, connect to the server as
<code class="literal">
member1
</code>
from the server host so that
the firewall sees a session account of
<code class="literal">
member1@localhost
</code>
. Then execute some
statements to be considered legitimate for the profile.
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16247387"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> title<span class="token punctuation">,</span> release_year <span class="token keyword">FROM</span> film <span class="token keyword">WHERE</span> film_id <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> actor <span class="token keyword">SET</span> last_update <span class="token operator">=</span> <span class="token function">NOW</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">WHERE</span> actor_id <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> store_id<span class="token punctuation">,</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> inventory <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> store_id<span class="token punctuation">;</span></code></pre>
</div>
<p>
The firewall receives the statements from the
<code class="literal">
member1@localhost
</code>
account. Because that
account is a member of the
<code class="literal">
fwgrp
</code>
profile, which is in
<code class="literal">
RECORDING
</code>
mode,
the firewall interprets the statements as applicable to
<code class="literal">
fwgrp
</code>
and records the normalized digest
form of the statements as rules in the
<code class="literal">
fwgrp
</code>
allowlist. Those rules then apply
to all accounts that are members of
<code class="literal">
fwgrp
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Until the
<code class="literal">
fwgrp
</code>
group profile
receives statements in
<code class="literal">
RECORDING
</code>
mode, its allowlist is empty, which is equivalent to
<span class="quote">
“
<span class="quote">
deny all.
</span>
”
</span>
No statement can match an empty
allowlist, which has these implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The group profile cannot be switched to
<code class="literal">
PROTECTING
</code>
mode. It would reject
every statement, effectively prohibiting the
accounts that are group members from executing any
statement.
</p>
</li>
<li class="listitem">
<p>
The group profile can be switched to
<code class="literal">
DETECTING
</code>
mode. In this case, the
profile accepts every statement but logs it as
suspicious.
</p>
</li>
</ul>
</div>
</div>
</li>
<li class="listitem">
<p>
At this point, the group profile information is cached,
including its name, membership, and allowlist. To see this
information, query the Performance Schema firewall tables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83459924"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">MODE</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>firewall_groups
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'fwgrp'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MODE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> RECORDING <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>firewall_membership
<span class="token keyword">WHERE</span> GROUP_ID <span class="token operator">=</span> <span class="token string">'fwgrp'</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> MEMBER_ID<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GROUP_ID <span class="token punctuation">|</span> MEMBER_ID <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> fwgrp <span class="token punctuation">|</span> member1@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> RULE <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>firewall_group_allowlist
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'fwgrp'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> RULE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT @@`version_comment` LIMIT ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> UPDATE `actor` SET `last_update` = NOW ( ) WHERE `actor_id` = ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT `title` , `release_year` FROM `film` WHERE `film_id` = ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT `store_id` , COUNT ( * ) FROM `inventory` GROUP BY `store_id` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
@@version_comment
</code>
rule comes from
a statement sent automatically by the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client when you connect to the
server.
</p>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Train the firewall under conditions matching application
use. For example, to determine server characteristics
and capabilities, a given MySQL connector might send
statements to the server at the beginning of each
session. If an application normally is used through that
connector, train the firewall using the connector, too.
That enables those initial statements to become part of
the allowlist for the group profile associated with the
application.
</p>
</div>
</li>
<li class="listitem">
<p>
Invoke
<code class="literal">
sp_set_firewall_group_mode()
</code>
again to switch the group profile to
<code class="literal">
PROTECTING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa69187228"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'PROTECTING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Switching the group profile out of
<code class="literal">
RECORDING
</code>
mode synchronizes its
cached data to the firewall database tables that provide
persistent underlying storage. If you do not switch the
mode for a profile that is being recorded, the cached
data is not written to persistent storage and is lost
when the server is restarted. The firewall database can
be the
<code class="literal">
mysql
</code>
system database or a
custom schema (see
<a class="xref" href="firewall-installation.html#firewall-install" title="Installing MySQL Enterprise Firewall">
Installing MySQL Enterprise Firewall
</a>
).
</p>
</div>
</li>
<li class="listitem">
<p>
Add to the group profile any other accounts that should be
members:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52371537"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_firewall_group_enlist<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'member2@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_firewall_group_enlist<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'member3@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_firewall_group_enlist<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'member4@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The profile allowlist trained using the
<code class="literal">
member1@localhost
</code>
account now also
applies to the additional accounts.
</p>
</li>
<li class="listitem">
<p>
To verify the updated group membership, query the
<code class="literal">
firewall_membership
</code>
table again:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34796565"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>firewall_membership
<span class="token keyword">WHERE</span> GROUP_ID <span class="token operator">=</span> <span class="token string">'fwgrp'</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> MEMBER_ID<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GROUP_ID <span class="token punctuation">|</span> MEMBER_ID <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> fwgrp <span class="token punctuation">|</span> member1@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> fwgrp <span class="token punctuation">|</span> member2@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> fwgrp <span class="token punctuation">|</span> member3@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> fwgrp <span class="token punctuation">|</span> member4@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Test the group profile against the firewall by using any
account in the group to execute some acceptable and
unacceptable statements. The firewall matches each
statement from the account against the profile allowlist
and accepts or rejects it:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This statement is not identical to a training
statement but produces the same normalized statement
as one of them, so the firewall accepts it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15541196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> title<span class="token punctuation">,</span> release_year <span class="token keyword">FROM</span> film <span class="token keyword">WHERE</span> film_id <span class="token operator">=</span> <span class="token number">98</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> title <span class="token punctuation">|</span> release_year <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BRIGHT ENCOUNTERS <span class="token punctuation">|</span> 2006 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
These statements match nothing in the allowlist, so
the firewall rejects each with an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58214140"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> title<span class="token punctuation">,</span> release_year <span class="token keyword">FROM</span> film <span class="token keyword">WHERE</span> film_id <span class="token operator">=</span> <span class="token number">98</span> <span class="token operator">OR</span> <span class="token boolean">TRUE</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">TABLES</span> <span class="token operator">LIKE</span> <span class="token string">'customer%'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span>
<span class="token prompt">mysql></span> <span class="token keyword">TRUNCATE</span> <span class="token keyword">TABLE</span> mysql<span class="token punctuation">.</span>slow_log<span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_trace">
<code class="literal">
mysql_firewall_trace
</code>
</a>
system variable is enabled, the firewall also writes
rejected statements to the error log. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa52874854"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] Plugin MYSQL_FIREWALL reported:
'ACCESS DENIED for 'member1@localhost'. Reason: No match in allowlist.
Statement: TRUNCATE TABLE `mysql` . `slow_log`'</code></pre>
</div>
<p>
These log messages may be helpful in identifying the
source of attacks, should that be necessary.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Should members need to be removed from the group profile,
use the
<code class="literal">
sp_firewall_group_delist()
</code>
stored procedure rather than
<code class="literal">
sp_firewall_group_enlist()
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12329770"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_firewall_group_delist<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'member3@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
<p>
The firewall group profile now is trained for member accounts.
When clients connect using any account in the group and
attempt to execute statements, the profile protects MySQL
against statements not matched by the profile allowlist.
</p>
<p>
The procedure just shown added only one member to the group
profile before training its allowlist. Doing so provides
better control over the training period by limiting which
accounts can add new acceptable statements to the allowlist.
Should additional training be necessary, you can switch the
profile back to
<code class="literal">
RECORDING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa42091119"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, that enables any member of the group to execute
statements and add them to the allowlist. To limit the
additional training to a single group member, call
<code class="literal">
sp_set_firewall_group_mode_and_user()
</code>
,
which is like
<code class="literal">
sp_set_firewall_group_mode()
</code>
but takes one more argument specifying which account is
permitted to train the profile in
<code class="literal">
RECORDING
</code>
mode. For example, to enable training only by
<code class="literal">
member4@localhost
</code>
, do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78400043"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode_and_user<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">,</span> <span class="token string">'member4@localhost'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
That enables additional training by the specified account
without having to remove the other group members. They can
execute statements, but the statements are not added to the
allowlist. (Remember, however, that in
<code class="literal">
RECORDING
</code>
mode the other members can
execute
<span class="emphasis">
<em>
any
</em>
</span>
statement.)
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
To avoid unexpected behavior when a particular account is
specified as the training account for a group profile,
always ensure that account is a member of the group.
</p>
</div>
<p>
After the additional training, set the group profile back to
<code class="literal">
PROTECTING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29718726"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'PROTECTING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The training account established by
<code class="literal">
sp_set_firewall_group_mode_and_user()
</code>
is
saved in the group profile, so the firewall remembers it in
case more training is needed later. Thus, if you call
<code class="literal">
sp_set_firewall_group_mode()
</code>
(which takes
no training account argument), the current profile training
account,
<code class="literal">
member4@localhost
</code>
, remains
unchanged.
</p>
<p>
To clear the training account if it actually is desired to
enable all group members to perform training in
<code class="literal">
RECORDING
</code>
mode, call
<code class="literal">
sp_set_firewall_group_mode_and_user()
</code>
and
pass a
<code class="literal">
NULL
</code>
value for the account argument:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa99051076"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode_and_user<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
It is possible to detect intrusions by logging nonmatching
statements as suspicious without denying access. First, put
the group profile in
<code class="literal">
DETECTING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59882536"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token string">'fwgrp'</span><span class="token punctuation">,</span> <span class="token string">'DETECTING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Then, using a member account, execute a statement that does
not match the group profile allowlist. In
<code class="literal">
DETECTING
</code>
mode, the firewall permits the
nonmatching statement to execute:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88906271"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">TABLES</span> <span class="token operator">LIKE</span> <span class="token string">'customer%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Tables_in_sakila (customer%) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> customer <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> customer_list <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
In addition, the firewall writes a message to the error log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa72058198"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] Plugin MYSQL_FIREWALL reported:
'SUSPICIOUS STATEMENT from 'member1@localhost'. Reason: No match in allowlist.
Statement: SHOW TABLES LIKE ?'</code></pre>
</div>
<p>
To disable a group profile, change its mode to
<code class="literal">
OFF
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61588619"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">group</em></span><span class="token punctuation">,</span> <span class="token string">'OFF'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To forget all training for a profile and disable it, reset it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa40735559"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_group_mode<span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">group</em></span><span class="token punctuation">,</span> <span class="token string">'RESET'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The reset operation causes the firewall to delete all rules
for the profile and set its mode to
<code class="literal">
OFF
</code>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-account-profiles">
</a>
Registering Firewall Account Profiles
</h5>
</div>
</div>
</div>
<p>
MySQL Enterprise Firewall enables profiles to be registered that correspond to
individual accounts. To use a firewall account profile to
protect MySQL against incoming statements from a given
account, follow these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Register the account profile and put it in
<code class="literal">
RECORDING
</code>
mode.
</p>
</li>
<li class="listitem">
<p>
Connect to the MySQL server using the account and execute
statements to be learned. This trains the account profile
and establishes the rules that form the profile allowlist.
</p>
</li>
<li class="listitem">
<p>
Switch the account profile to
<code class="literal">
PROTECTING
</code>
mode. When a client connects
to the server using the account, the account profile
allowlist restricts statement execution.
</p>
</li>
<li class="listitem">
<p>
Should additional training be necessary, switch the
account profile to
<code class="literal">
RECORDING
</code>
mode
again, update its allowlist with new statement patterns,
then switch it back to
<code class="literal">
PROTECTING
</code>
mode.
</p>
</li>
</ol>
</div>
<p>
Observe these guidelines for firewall-related account
references:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Take note of the context in which account references
occur. To name an account for firewall operations, specify
it as a single quoted string
(
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
@
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
).
This differs from the usual MySQL convention for
statements such as
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE
USER
</code>
</a>
and
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
,
for which you quote the user and host parts of an account
name separately
(
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
'@'
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
).
</p>
<p>
The requirement for naming accounts as a single quoted
string for firewall operations means that you cannot use
accounts that have embedded
<code class="literal">
@
</code>
characters in the user name.
</p>
</li>
<li class="listitem">
<p>
The firewall assesses statements against accounts
represented by actual user and host names as authenticated
by the server. When registering accounts in profiles, do
not use wildcard characters or netmasks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Suppose that an account named
<code class="literal">
me@%.example.org
</code>
exists and a
client uses it to connect to the server from the host
<code class="literal">
abc.example.org
</code>
.
</p>
</li>
<li class="listitem">
<p>
The account name contains a
<code class="literal">
%
</code>
wildcard character, but the server authenticates the
client as having a user name of
<code class="literal">
me
</code>
and host name of
<code class="literal">
abc.example.com
</code>
,
and that is what the firewall sees.
</p>
</li>
<li class="listitem">
<p>
Consequently, the account name to use for firewall
operations is
<code class="literal">
[email protected]
</code>
rather than
<code class="literal">
me@%.example.org
</code>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
The following procedure shows how to register an account
profile with the firewall, train the firewall to know the
acceptable statements for that profile (its allowlist), and
use the profile to protect MySQL against execution of
unacceptable statements by the account. The example account,
<code class="literal">
fwuser@localhost
</code>
, is presumed for use by an
application that accesses tables in the
<code class="literal">
sakila
</code>
database (available at
<a class="ulink" href="/doc/index-other.html" target="_top">
https://dev.mysql.com/doc/index-other.html
</a>
).
</p>
<p>
Use an administrative MySQL account to perform the steps in
this procedure, except those steps designated for execution by
the
<code class="literal">
fwuser@localhost
</code>
account that
corresponds to the account profile registered with the
firewall. For statements executed using this account, the
default database should be
<code class="literal">
sakila
</code>
. (You can
use a different database by adjusting the instructions
accordingly.)
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
If necessary, create the account to use for executing
statements (choose an appropriate password) and grant it
privileges for the
<code class="literal">
sakila
</code>
database:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61395829"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'fwuser'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> sakila<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'fwuser'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
sp_set_firewall_mode()
</code>
stored
procedure to register the account profile with the
firewall and place the profile in
<code class="literal">
RECORDING
</code>
(training) mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21145759"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token string">'fwuser@localhost'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you have installed MySQL Enterprise Firewall in a custom schema, then
make appropriate substitution for your system. For
example, if the firewall is installed in the
<code class="literal">
fwdb
</code>
schema, then execute the stored
procedures like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8355388"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> fwdb<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token string">'fwuser@localhost'</span><span class="token punctuation">,</span> <span class="token string">'RECORDING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
</p>
</div>
</li>
<li class="listitem">
<p>
To train the registered account profile, connect to the
server as
<code class="literal">
fwuser
</code>
from the server host
so that the firewall sees a session account of
<code class="literal">
fwuser@localhost
</code>
. Then use the account
to execute some statements to be considered legitimate for
the profile. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60282430"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">FROM</span> customer <span class="token keyword">WHERE</span> customer_id <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> rental <span class="token keyword">SET</span> return_date <span class="token operator">=</span> <span class="token function">NOW</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">WHERE</span> rental_id <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> get_customer_balance<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token function">NOW</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Because the profile is in
<code class="literal">
RECORDING
</code>
mode, the firewall records the normalized digest form of
the statements as rules in the profile allowlist.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Until the
<code class="literal">
fwuser@localhost
</code>
account
profile receives statements in
<code class="literal">
RECORDING
</code>
mode, its allowlist is
empty, which is equivalent to
<span class="quote">
“
<span class="quote">
deny all.
</span>
”
</span>
No statement can match an empty allowlist, which has
these implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The account profile cannot be switched to
<code class="literal">
PROTECTING
</code>
mode. It would reject
every statement, effectively prohibiting the account
from executing any statement.
</p>
</li>
<li class="listitem">
<p>
The account profile can be switched to
<code class="literal">
DETECTING
</code>
mode. In this case, the
profile accepts every statement but logs it as
suspicious.
</p>
</li>
</ul>
</div>
</div>
</li>
<li class="listitem">
<p>
At this point, the account profile information is cached.
To see this information, query the
<code class="literal">
INFORMATION_SCHEMA
</code>
firewall tables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59737291"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">MODE</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>MYSQL_FIREWALL_USERS
<span class="token keyword">WHERE</span> USERHOST <span class="token operator">=</span> <span class="token string">'fwuser@localhost'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MODE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> RECORDING <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> RULE <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>MYSQL_FIREWALL_WHITELIST
<span class="token keyword">WHERE</span> USERHOST <span class="token operator">=</span> <span class="token string">'fwuser@localhost'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> RULE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT `first_name` , `last_name` FROM `customer` WHERE `customer_id` = ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT `get_customer_balance` ( ? , NOW ( ) ) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> UPDATE `rental` SET `return_date` = NOW ( ) WHERE `rental_id` = ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> SELECT @@`version_comment` LIMIT ? <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
@@version_comment
</code>
rule comes from
a statement sent automatically by the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client when you connect to the
server.
</p>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Train the firewall under conditions matching application
use. For example, to determine server characteristics
and capabilities, a given MySQL connector might send
statements to the server at the beginning of each
session. If an application normally is used through that
connector, train the firewall using the connector, too.
That enables those initial statements to become part of
the allowlist for the account profile associated with
the application.
</p>
</div>
</li>
<li class="listitem">
<p>
Invoke
<code class="literal">
sp_set_firewall_mode()
</code>
again,
this time switching the account profile to
<code class="literal">
PROTECTING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63433214"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token string">'fwuser@localhost'</span><span class="token punctuation">,</span> <span class="token string">'PROTECTING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Switching the account profile out of
<code class="literal">
RECORDING
</code>
mode synchronizes its
cached data to the firewall database tables that provide
persistent underlying storage. If you do not switch the
mode for a profile that is being recorded, the cached
data is not written to persistent storage and is lost
when the server is restarted. The firewall database can
be the
<code class="literal">
mysql
</code>
system database or a
custom schema (see
<a class="xref" href="firewall-installation.html#firewall-install" title="Installing MySQL Enterprise Firewall">
Installing MySQL Enterprise Firewall
</a>
).
</p>
</div>
</li>
<li class="listitem">
<p>
Test the account profile by using the account to execute
some acceptable and unacceptable statements. The firewall
matches each statement from the account against the
profile allowlist and accepts or rejects it:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This statement is not identical to a training
statement but produces the same normalized statement
as one of them, so the firewall accepts it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5622187"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">FROM</span> customer <span class="token keyword">WHERE</span> customer_id <span class="token operator">=</span> <span class="token string">'48'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> first_name <span class="token punctuation">|</span> last_name <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ANN <span class="token punctuation">|</span> EVANS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
These statements match nothing in the allowlist, so
the firewall rejects each with an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32048369"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> first_name<span class="token punctuation">,</span> last_name <span class="token keyword">FROM</span> customer <span class="token keyword">WHERE</span> customer_id <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">OR</span> <span class="token boolean">TRUE</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">TABLES</span> <span class="token operator">LIKE</span> <span class="token string">'customer%'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span>
<span class="token prompt">mysql></span> <span class="token keyword">TRUNCATE</span> <span class="token keyword">TABLE</span> mysql<span class="token punctuation">.</span>slow_log<span class="token punctuation">;</span>
<span class="token output">ERROR 1045 (28000)<span class="token punctuation">:</span> Statement was blocked by Firewall</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_trace">
<code class="literal">
mysql_firewall_trace
</code>
</a>
system variable is enabled, the firewall also writes
rejected statements to the error log. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa46265879"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] Plugin MYSQL_FIREWALL reported:
'ACCESS DENIED for fwuser@localhost. Reason: No match in allowlist.
Statement: TRUNCATE TABLE `mysql` . `slow_log`'</code></pre>
</div>
<p>
These log messages may be helpful in identifying the
source of attacks, should that be necessary.
</p>
</li>
</ul>
</div>
</li>
</ol>
</div>
<p>
The firewall account profile now is trained for the
<code class="literal">
fwuser@localhost
</code>
account. When clients
connect using that account and attempt to execute statements,
the profile protects MySQL against statements not matched by
the profile allowlist.
</p>
<p>
It is possible to detect intrusions by logging nonmatching
statements as suspicious without denying access. First, put
the account profile in
<code class="literal">
DETECTING
</code>
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59206685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token string">'fwuser@localhost'</span><span class="token punctuation">,</span> <span class="token string">'DETECTING'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Then, using the account, execute a statement that does not
match the account profile allowlist. In
<code class="literal">
DETECTING
</code>
mode, the firewall permits the
nonmatching statement to execute:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32610723"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">TABLES</span> <span class="token operator">LIKE</span> <span class="token string">'customer%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Tables_in_sakila (customer%) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> customer <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> customer_list <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
In addition, the firewall writes a message to the error log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa57734148"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] Plugin MYSQL_FIREWALL reported:
'SUSPICIOUS STATEMENT from 'fwuser@localhost'. Reason: No match in allowlist.
Statement: SHOW TABLES LIKE ?'</code></pre>
</div>
<p>
To disable an account profile, change its mode to
<code class="literal">
OFF
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa83625449"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">user</em></span><span class="token punctuation">,</span> <span class="token string">'OFF'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To forget all training for a profile and disable it, reset it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa95946845"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_set_firewall_mode<span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">user</em></span><span class="token punctuation">,</span> <span class="token string">'RESET'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The reset operation causes the firewall to delete all rules
for the profile and set its mode to
<code class="literal">
OFF
</code>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-monitoring">
</a>
Monitoring the Firewall
</h5>
</div>
</div>
</div>
<p>
To assess firewall activity, examine its status variables. For
example, after performing the procedure shown earlier to train
and protect the
<code class="literal">
fwgrp
</code>
group profile, the
variables look like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11573103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Firewall%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Firewall_access_denied <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Firewall_access_granted <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Firewall_access_suspicious <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Firewall_cached_entries <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The variables indicate the number of statements rejected,
accepted, logged as suspicious, and added to the cache,
respectively. The
<a class="link" href="firewall-reference.html#statvar_Firewall_access_granted">
<code class="literal">
Firewall_access_granted
</code>
</a>
count is 4 because of the
<code class="literal">
@@version_comment
</code>
statement sent by the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client each of
the three times you connected using the registered account,
plus the
<a class="link" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
<code class="literal">
SHOW TABLES
</code>
</a>
statement
that was not blocked in
<code class="literal">
DETECTING
</code>
mode.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="firewall-account-profile-migration">
</a>
Migrating Account Profiles to Group Profiles
</h5>
</div>
</div>
</div>
<p>
MySQL Enterprise Firewall supports account profiles that each apply to a single
account and also group profiles that each can apply to
multiple accounts. A group profile enables easier
administration when the same allowlist is to be applied to
multiple accounts: instead of creating one account profile per
account and duplicating the allowlist across all those
profiles, create a single group profile and make the accounts
members of it. The group allowlist then applies to all the
accounts.
</p>
<p>
A group profile with a single member account is logically
equivalent to an account profile for that account, so it is
possible to administer the firewall using group profiles
exclusively, rather than a mix of account and group profiles.
For new firewall installations, that is accomplished by
uniformly creating new profiles as group profiles and avoiding
account profiles.
</p>
<p>
Due to the greater flexibility offered by group profiles, it
is recommended that all new firewall profiles be created as
group profiles. Account profiles are deprecated, and subject
to removal in a future MySQL version. For upgrades from
firewall installations that already contain account profiles,
MySQL Enterprise Firewall includes a stored procedure named
<code class="literal">
sp_migrate_firewall_user_to_group()
</code>
to help
you convert account profiles to group profiles. To use it,
perform the following procedure as a user who has the
<a class="link" href="privileges-provided.html#priv_firewall-admin">
<code class="literal">
FIREWALL_ADMIN
</code>
</a>
privilege:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Run the
<code class="filename">
firewall_profile_migration.sql
</code>
script
to install the
<code class="literal">
sp_migrate_firewall_user_to_group()
</code>
stored procedure. The script is located in the
<code class="filename">
share
</code>
directory of your MySQL
installation.
</p>
<p>
Specify the same firewall database name on the command
line that you previously defined for your firewall
installation. The example here specifies the system
database,
<code class="literal">
mysql
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83726553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-D</span> mysql < firewall_profile_migration<span class="token punctuation">.</span>sql
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
</div>
<p>
If you installed MySQL Enterprise Firewall in a custom schema, make the
appropriate substitution for your system.
</p>
</li>
<li class="listitem">
<p>
Identify which account profiles exist by querying the
Information Schema
<a class="link" href="information-schema-mysql-firewall-users-table.html" title="28.7.2 The INFORMATION_SCHEMA MYSQL_FIREWALL_USERS Table">
<code class="literal">
MYSQL_FIREWALL_USERS
</code>
</a>
table.
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68655544"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> USERHOST <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>MYSQL_FIREWALL_USERS<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> USERHOST <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> admin@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> local_client@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> [email protected] <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For each account profile identified by the previous step,
convert it to a group profile. Replace the
<code class="literal">
mysql.
</code>
prefix with the actual firewall
database name, if necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35693421"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_migrate_firewall_user_to_group<span class="token punctuation">(</span><span class="token string">'admin@localhost'</span><span class="token punctuation">,</span> <span class="token string">'admins'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_migrate_firewall_user_to_group<span class="token punctuation">(</span><span class="token string">'local_client@localhost'</span><span class="token punctuation">,</span> <span class="token string">'local_clients'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> mysql<span class="token punctuation">.</span>sp_migrate_firewall_user_to_group<span class="token punctuation">(</span><span class="token string">'remote_client@localhost'</span><span class="token punctuation">,</span> <span class="token string">'remote_clients'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In each case, the account profile must exist and must not
currently be in
<code class="literal">
RECORDING
</code>
mode, and the
group profile must not already exist. The resulting group
profile has the named account as its single enlisted
member, which is also set as the group training account.
The group profile operational mode is taken from the
account profile operational mode.
</p>
</li>
<li class="listitem">
<p>
(Optional) Remove
<code class="literal">
sp_migrate_firewall_user_to_group()
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa94992090"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> mysql<span class="token punctuation">.</span>sp_migrate_firewall_user_to_group<span class="token punctuation">;</span></code></pre>
</div>
<p>
If you installed MySQL Enterprise Firewall in a custom schema, make the
appropriate substitution for your system.
</p>
</li>
</ol>
</div>
<p>
For additional details about
<code class="literal">
sp_migrate_firewall_user_to_group()
</code>
, see
<a class="xref" href="firewall-reference.html#firewall-stored-routines-miscellaneous" title="Firewall Miscellaneous Stored Procedures">
Firewall Miscellaneous Stored Procedures
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/view-algorithms.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="view-algorithms">
</a>
27.5.2 View Processing Algorithms
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045081886144">
</a>
<p>
The optional
<code class="literal">
ALGORITHM
</code>
clause for
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
or
<a class="link" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
<code class="literal">
ALTER VIEW
</code>
</a>
is a MySQL extension to
standard SQL. It affects how MySQL processes the view.
<code class="literal">
ALGORITHM
</code>
takes three values:
<code class="literal">
MERGE
</code>
,
<code class="literal">
TEMPTABLE
</code>
, or
<code class="literal">
UNDEFINED
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<code class="literal">
MERGE
</code>
, the text of a statement that
refers to the view and the view definition are merged such
that parts of the view definition replace corresponding parts
of the statement.
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
TEMPTABLE
</code>
, the results from the view
are retrieved into a temporary table, which then is used to
execute the statement.
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
UNDEFINED
</code>
, MySQL chooses which
algorithm to use. It prefers
<code class="literal">
MERGE
</code>
over
<code class="literal">
TEMPTABLE
</code>
if possible, because
<code class="literal">
MERGE
</code>
is usually more efficient and because
a view cannot be updatable if a temporary table is used.
</p>
</li>
<li class="listitem">
<p>
If no
<code class="literal">
ALGORITHM
</code>
clause is present, the
default algorithm is determined by the value of the
<a class="link" href="switchable-optimizations.html#optflag_derived-merge">
<code class="literal">
derived_merge
</code>
</a>
flag of the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable. For additional discussion, see
<a class="xref" href="derived-table-optimization.html" title="10.2.2.4 Optimizing Derived Tables, View References, and Common Table Expressions with Merging or Materialization">
Section 10.2.2.4, “Optimizing Derived Tables, View References, and Common Table Expressions
with Merging or Materialization”
</a>
.
</p>
</li>
</ul>
</div>
<p>
A reason to specify
<code class="literal">
TEMPTABLE
</code>
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
<code class="literal">
MERGE
</code>
algorithm so that other
clients that use the view are not blocked as long.
</p>
<p>
A view algorithm can be
<code class="literal">
UNDEFINED
</code>
for three
reasons:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
No
<code class="literal">
ALGORITHM
</code>
clause is present in the
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
statement has
an explicit
<code class="literal">
ALGORITHM = UNDEFINED
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ALGORITHM = MERGE
</code>
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
<code class="literal">
UNDEFINED
</code>
.
</p>
</li>
</ul>
</div>
<p>
As mentioned earlier,
<code class="literal">
MERGE
</code>
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
<code class="literal">
MERGE
</code>
algorithm works. The
examples assume that there is a view
<code class="literal">
v_merge
</code>
that has this definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20922127"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">ALGORITHM</span> <span class="token operator">=</span> <span class="token keyword">MERGE</span> <span class="token keyword">VIEW</span> v_merge <span class="token punctuation">(</span>vc1<span class="token punctuation">,</span> vc2<span class="token punctuation">)</span> <span class="token keyword">AS</span>
<span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> c2 <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> c3 <span class="token operator">></span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example 1: Suppose that we issue this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa504665"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> v_merge<span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL handles the statement as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
v_merge
</code>
becomes
<code class="literal">
t
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
*
</code>
becomes
<code class="literal">
vc1, vc2
</code>
,
which corresponds to
<code class="literal">
c1, c2
</code>
</p>
</li>
<li class="listitem">
<p>
The view
<code class="literal">
WHERE
</code>
clause is added
</p>
</li>
</ul>
</div>
<p>
The resulting statement to be executed becomes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa48748879"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> c2 <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> c3 <span class="token operator">></span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example 2: Suppose that we issue this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa80698225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> v_merge <span class="token keyword">WHERE</span> vc1 <span class="token operator"><</span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This statement is handled similarly to the previous one, except
that
<code class="literal">
vc1 < 100
</code>
becomes
<code class="literal">
c1 <
100
</code>
and the view
<code class="literal">
WHERE
</code>
clause is
added to the statement
<code class="literal">
WHERE
</code>
clause using an
<a class="link" href="logical-operators.html#operator_and">
<code class="literal">
AND
</code>
</a>
connective (and parentheses are
added to make sure the parts of the clause are executed with
correct precedence). The resulting statement to be executed
becomes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa18534644"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> c2 <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> <span class="token punctuation">(</span>c3 <span class="token operator">></span> <span class="token number">100</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>c1 <span class="token operator"><</span> <span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Effectively, the statement to be executed has a
<code class="literal">
WHERE
</code>
clause of this form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa95337261"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">WHERE</span> <span class="token punctuation">(</span><span class="token keyword">select</span> <span class="token keyword">WHERE</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span><span class="token keyword">view</span> <span class="token keyword">WHERE</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
If the
<code class="literal">
MERGE
</code>
algorithm cannot be used, a
temporary table must be used instead. Constructs that prevent
merging are the same as those that prevent merging in derived
tables and common table expressions. Examples are
<code class="literal">
SELECT
DISTINCT
</code>
or
<code class="literal">
LIMIT
</code>
in the subquery.
For details, see
<a class="xref" href="derived-table-optimization.html" title="10.2.2.4 Optimizing Derived Tables, View References, and Common Table Expressions with Merging or Materialization">
Section 10.2.2.4, “Optimizing Derived Tables, View References, and Common Table Expressions
with Merging or Materialization”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-processlist.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-processlist">
</a>
15.7.7.31 SHOW PROCESSLIST Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045169918416">
</a>
<a class="indexterm" name="idm46045169917376">
</a>
<a class="indexterm" name="idm46045169916304">
</a>
<a class="indexterm" name="idm46045169915216">
</a>
<a class="indexterm" name="idm46045169913728">
</a>
<a class="indexterm" name="idm46045169912240">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa77614371"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token punctuation">[</span><span class="token keyword">FULL</span><span class="token punctuation">]</span> <span class="token keyword">PROCESSLIST</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The INFORMATION SCHEMA implementation of
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
is deprecated
and subject to removal in a future MySQL release. It is
recommended to use the Performance Schema implementation of
<code class="literal">
SHOW PROCESSLIST
</code>
instead.
</p>
</div>
<p>
The MySQL process list indicates the operations currently being
performed by the set of threads executing within the server. The
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement is one
source of process information. For a comparison of this
statement with other sources, see
<a class="xref" href="processlist-access.html#processlist-sources" title="Sources of Process Information">
Sources of Process Information
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
An alternative implementation for
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
is available based on the Performance
Schema
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
processlist
</code>
</a>
table, which,
unlike the default
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
implementation, does not require a mutex
and has better performance characteristics. For details, see
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
.
</p>
</div>
<p>
If you have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege, you can see all threads, even those belonging to
other users. Otherwise (without the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege), nonanonymous
users have access to information about their own threads but not
threads for other users, and anonymous users have no access to
thread information.
</p>
<p>
Without the
<code class="literal">
FULL
</code>
keyword,
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
displays only
the first 100 characters of each statement in the
<code class="literal">
Info
</code>
field.
</p>
<p>
The
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement is
very useful if you get the
<span class="quote">
“
<span class="quote">
too many connections
</span>
”
</span>
error message and want to find out what is going on. MySQL
reserves one extra connection to be used by accounts that have
the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege), to ensure that administrators should always be able
to connect and check the system (assuming that you are not
giving this privilege to all your users).
</p>
<p>
Threads can be killed with the
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
statement. See
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
.
</p>
<p>
Example of
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74913005"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">FULL</span> <span class="token keyword">PROCESSLIST</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 1
User<span class="token punctuation">:</span> system user
Host<span class="token punctuation">:</span>
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
Time<span class="token punctuation">:</span> 1030455
State<span class="token punctuation">:</span> Waiting for source to send event
Info<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 2
User<span class="token punctuation">:</span> system user
Host<span class="token punctuation">:</span>
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
Time<span class="token punctuation">:</span> 1004
State<span class="token punctuation">:</span> Has read all relay log; waiting for the replica
I/O thread to update it
Info<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 3112
User<span class="token punctuation">:</span> replikator
Host<span class="token punctuation">:</span> artemis<span class="token punctuation">:</span>2204
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Binlog Dump
Time<span class="token punctuation">:</span> 2144
State<span class="token punctuation">:</span> Has sent all binlog to replica; waiting for binlog to be updated
Info<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 4. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 3113
User<span class="token punctuation">:</span> replikator
Host<span class="token punctuation">:</span> iconnect2<span class="token punctuation">:</span>45781
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Binlog Dump
Time<span class="token punctuation">:</span> 2086
State<span class="token punctuation">:</span> Has sent all binlog to replica; waiting for binlog to be updated
Info<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 3123
User<span class="token punctuation">:</span> stefan
Host<span class="token punctuation">:</span> localhost
db<span class="token punctuation">:</span> apollon
Command<span class="token punctuation">:</span> Query
Time<span class="token punctuation">:</span> 0
State<span class="token punctuation">:</span> NULL
Info<span class="token punctuation">:</span> SHOW FULL PROCESSLIST</span></code></pre>
</div>
<p>
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
output has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="processlist_id">
</a>
<code class="literal">
Id
</code>
</p>
<p>
The connection identifier. This is the same value displayed
in the
<code class="literal">
ID
</code>
column of the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table, displayed in
the
<code class="literal">
PROCESSLIST_ID
</code>
column of the
Performance Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table, and returned by the
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
function
within the thread.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_user">
</a>
<code class="literal">
User
</code>
</p>
<p>
The MySQL user who issued the statement. A value of
<code class="literal">
system user
</code>
refers to a nonclient thread
spawned by the server to handle tasks internally, for
example, a delayed-row handler thread or an I/O (receiver)
or SQL (applier) thread used on replica hosts. For
<code class="literal">
system user
</code>
, there is no host specified
in the
<code class="literal">
Host
</code>
column.
<code class="literal">
unauthenticated user
</code>
refers to a thread
that has become associated with a client connection but for
which authentication of the client user has not yet
occurred.
<code class="literal">
event_scheduler
</code>
refers to the
thread that monitors scheduled events (see
<a class="xref" href="event-scheduler.html" title="27.4 Using the Event Scheduler">
Section 27.4, “Using the Event Scheduler”
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A
<code class="literal">
User
</code>
value of
<code class="literal">
system
user
</code>
is distinct from the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege. The
former designates internal threads. The latter
distinguishes the system user and regular user account
categories (see
<a class="xref" href="account-categories.html" title="8.2.11 Account Categories">
Section 8.2.11, “Account Categories”
</a>
).
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="processlist_host">
</a>
<code class="literal">
Host
</code>
</p>
<p>
The host name of the client issuing the statement (except
for
<code class="literal">
system user
</code>
, for which there is no
host). The host name for TCP/IP connections is reported in
<code class="literal">
<em class="replaceable">
<code>
host_name
</code>
</em>
:
<em class="replaceable">
<code>
client_port
</code>
</em>
</code>
format to make it easier to determine which client is doing
what.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_db">
</a>
<code class="literal">
db
</code>
</p>
<p>
The default database for the thread, or
<code class="literal">
NULL
</code>
if none has been selected.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_command">
</a>
<code class="literal">
Command
</code>
</p>
<p>
The type of command the thread is executing on behalf of the
client, or
<code class="literal">
Sleep
</code>
if the session is idle.
For descriptions of thread commands, see
<a class="xref" href="thread-information.html" title="10.14 Examining Server Thread (Process) Information">
Section 10.14, “Examining Server Thread (Process) Information”
</a>
. The value of this
column corresponds to the
<code class="literal">
COM_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
commands of the client/server protocol and
<code class="literal">
Com_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
status
variables. See
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_time">
</a>
<code class="literal">
Time
</code>
</p>
<p>
The time in seconds that the thread has been in its current
state. For a replica SQL thread, the value is the number of
seconds between the timestamp of the last replicated event
and the real time of the replica host. See
<a class="xref" href="replication-threads.html" title="19.2.3 Replication Threads">
Section 19.2.3, “Replication Threads”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_state">
</a>
<code class="literal">
State
</code>
</p>
<p>
An action, event, or state that indicates what the thread is
doing. For descriptions of
<code class="literal">
State
</code>
values,
see
<a class="xref" href="thread-information.html" title="10.14 Examining Server Thread (Process) Information">
Section 10.14, “Examining Server Thread (Process) Information”
</a>
.
</p>
<p>
Most states correspond to very quick operations. If a thread
stays in a given state for many seconds, there might be a
problem that needs to be investigated.
</p>
</li>
<li class="listitem">
<p>
<a name="processlist_info">
</a>
<code class="literal">
Info
</code>
</p>
<p>
The statement the thread is executing, or
<code class="literal">
NULL
</code>
if it is executing no statement. The
statement might be the one sent to the server, or an
innermost statement if the statement executes other
statements. For example, if a
<code class="literal">
CALL
</code>
statement executes a stored procedure that is executing a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement, the
<code class="literal">
Info
</code>
value shows the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/bit-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="bit-functions">
</a>
14.12 Bit Functions and Operators
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045199995568">
</a>
<a class="indexterm" name="idm46045199994112">
</a>
<a class="indexterm" name="idm46045199992624">
</a>
<a class="indexterm" name="idm46045199991552">
</a>
<a class="indexterm" name="idm46045199990480">
</a>
<a class="indexterm" name="idm46045199988976">
</a>
<a class="indexterm" name="idm46045199987520">
</a>
<a class="indexterm" name="idm46045199986448">
</a>
<div class="table">
<a name="idm46045199985376">
</a>
<p class="title">
<b>
Table 14.17 Bit Functions and Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists bit functions and operators.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
</td>
<td>
Bitwise AND
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
</td>
<td>
Right shift
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
</td>
<td>
Left shift
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
</td>
<td>
Bitwise XOR
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#function_bit-count">
<code class="literal">
BIT_COUNT()
</code>
</a>
</td>
<td>
Return the number of bits that are set
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_bitwise-or">
<code class="literal">
|
</code>
</a>
</td>
<td>
Bitwise OR
</td>
</tr>
<tr>
<td>
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
</td>
<td>
Bitwise inversion
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The following list describes available bit functions and
operators:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="operator_bitwise-or">
</a>
<p>
<a class="link" href="bit-functions.html#operator_bitwise-or">
<code class="literal">
|
</code>
</a>
</p>
<a class="indexterm" name="idm46045199952992">
</a>
<a class="indexterm" name="idm46045199951920">
</a>
<p>
Bitwise OR.
</p>
<p>
The result type depends on whether the arguments are evaluated
as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the arguments have a
binary string type, and at least one of them is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation occurs
otherwise, with argument conversion to unsigned 64-bit
integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the arguments. If the arguments have
unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19581886"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">29</span> <span class="token operator">|</span> <span class="token number">15</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">31</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'40404040'</span> <span class="token operator">|</span> X<span class="token string">'01020304'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'ABCD'</span></code></pre>
</div>
<p>
If bitwise OR is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_bitwise-and">
</a>
<p>
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
</p>
<a class="indexterm" name="idm46045199932080">
</a>
<a class="indexterm" name="idm46045199930992">
</a>
<p>
Bitwise AND.
</p>
<p>
The result type depends on whether the arguments are evaluated
as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the arguments have a
binary string type, and at least one of them is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation occurs
otherwise, with argument conversion to unsigned 64-bit
integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the arguments. If the arguments have
unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95018838"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">29</span> <span class="token operator">&</span> <span class="token number">15</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">13</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'FF'</span> <span class="token operator">&</span> b<span class="token string">'11110000'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'F0'</span></code></pre>
</div>
<p>
If bitwise AND is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_bitwise-xor">
</a>
<p>
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
</p>
<a class="indexterm" name="idm46045199911168">
</a>
<a class="indexterm" name="idm46045199910096">
</a>
<p>
Bitwise XOR.
</p>
<p>
The result type depends on whether the arguments are evaluated
as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the arguments have a
binary string type, and at least one of them is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation occurs
otherwise, with argument conversion to unsigned 64-bit
integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the arguments. If the arguments have
unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21893633"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">^</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">^</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">11</span> <span class="token operator">^</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">8</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'FEDC'</span> <span class="token operator">^</span> X<span class="token string">'1111'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'EFCD'</span></code></pre>
</div>
<p>
If bitwise XOR is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_left-shift">
</a>
<p>
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
</p>
<a class="indexterm" name="idm46045199888768">
</a>
<p>
Shifts a longlong (
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
)
number or binary string to the left.
</p>
<p>
The result type depends on whether the bit argument is
evaluated as a binary string or number:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the bit argument has
a binary string type, and is not a hexadecimal literal,
bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric
evaluation occurs otherwise, with argument conversion to
an unsigned 64-bit integer as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the bit argument. Numeric evaluation
produces an unsigned 64-bit integer.
</p>
</li>
</ul>
</div>
<p>
Bits shifted off the end of the value are lost without
warning, regardless of the argument type. In particular, if
the shift count is greater or equal to the number of bits in
the bit argument, all bits in the result are 0.
</p>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70811314"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator"><<</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">4</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'00FF00FF00FF'</span> <span class="token operator"><<</span> <span class="token number">8</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'FF00FF00FF00'</span></code></pre>
</div>
<p>
If a bit shift is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_right-shift">
</a>
<p>
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
</p>
<a class="indexterm" name="idm46045199868528">
</a>
<p>
Shifts a longlong (
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
)
number or binary string to the right.
</p>
<p>
The result type depends on whether the bit argument is
evaluated as a binary string or number:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the bit argument has
a binary string type, and is not a hexadecimal literal,
bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric
evaluation occurs otherwise, with argument conversion to
an unsigned 64-bit integer as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the bit argument. Numeric evaluation
produces an unsigned 64-bit integer.
</p>
</li>
</ul>
</div>
<p>
Bits shifted off the end of the value are lost without
warning, regardless of the argument type. In particular, if
the shift count is greater or equal to the number of bits in
the bit argument, all bits in the result are 0.
</p>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70113209"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">4</span> <span class="token operator">>></span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'00FF00FF00FF'</span> <span class="token operator">>></span> <span class="token number">8</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'0000FF00FF00'</span></code></pre>
</div>
<p>
If a bit shift is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_bitwise-invert">
</a>
<p>
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
</p>
<a class="indexterm" name="idm46045199848368">
</a>
<p>
Invert all bits.
</p>
<p>
The result type depends on whether the bit argument is
evaluated as a binary string or number:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the bit argument has
a binary string type, and is not a hexadecimal literal,
bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric
evaluation occurs otherwise, with argument conversion to
an unsigned 64-bit integer as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the bit argument. Numeric evaluation
produces an unsigned 64-bit integer.
</p>
</li>
</ul>
</div>
<p>
For more information, see the introductory discussion in this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83283315"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">5</span> <span class="token operator">&</span> <span class="token operator">~</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">4</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token operator">~</span>X<span class="token string">'0000FFFF1111EEEE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'FFFF0000EEEE1111'</span></code></pre>
</div>
<p>
If bitwise inversion is invoked from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string results display
using hexadecimal notation, depending on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_bit-count">
</a>
<p>
<a class="link" href="bit-functions.html#function_bit-count">
<code class="literal">
BIT_COUNT(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045199829824">
</a>
<p>
Returns the number of bits that are set in the argument
<em class="replaceable">
<code>
N
</code>
</em>
as an unsigned 64-bit integer, or
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33362988"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span><span class="token number">64</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span><span class="token datatype">BINARY</span> <span class="token number">64</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">7</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span><span class="token string">'64'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span>_binary <span class="token string">'64'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">7</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span>X<span class="token string">'40'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span>_binary X<span class="token string">'40'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Bit functions and operators comprise
<a class="link" href="bit-functions.html#function_bit-count">
<code class="literal">
BIT_COUNT()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_bitwise-or">
<code class="literal">
|
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
, and
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
.
(The
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
, and
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
aggregate functions are
described in
<a class="xref" href="aggregate-functions.html" title="14.19.1 Aggregate Function Descriptions">
Section 14.19.1, “Aggregate Function Descriptions”
</a>
.)
</p>
<p>
Bit functions and operators permit binary string type arguments
(
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, and the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
types) and return a value of
like type. Nonbinary string arguments are converted to
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations" title="Bit Operations">
Bit Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-binary-string-examples" title="Binary String Bit-Operation Examples">
Binary String Bit-Operation Examples
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-and-or-xor" title="Bitwise AND, OR, and XOR Operations">
Bitwise AND, OR, and XOR Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-complement-shift" title="Bitwise Complement and Shift Operations">
Bitwise Complement and Shift Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-bit-count" title="BIT_COUNT() Operations">
BIT_COUNT() Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-bit-aggregate" title="BIT_AND(), BIT_OR(), and BIT_XOR() Operations">
BIT_AND(), BIT_OR(), and BIT_XOR() Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="bit-functions.html#bit-operations-literal-handling" title="Special Handling of Hexadecimal Literals, Bit Literals, and NULL Literals">
Special Handling of Hexadecimal Literals, Bit Literals, and NULL
Literals
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations">
</a>
Bit Operations
</h3>
</div>
</div>
</div>
<p>
MySQL 8.4 handles binary string arguments directly
(without conversion) and produces binary string results.
Arguments that are not integers or binary strings are converted
to integers.
</p>
<p>
Arguments that count as binary strings include column values,
routine parameters, local variables, and user-defined variables
that have a binary string type:
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, or one of the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
types.
</p>
<p>
You can specify arguments to bit operations using hexadecimal
literals or bit literals with the intent that they represent
numbers; MySQL evaluates bit operations in numeric context when
all bit arguments are hexadecimal or bit literals. For
evaluation as binary strings instead, use the
<code class="literal">
_binary
</code>
introducer for at least one of the
literal values.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
These bit operations evaluate the hexadecimal literals and
bit literals as integers:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2709562"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'01'</span><span class="token punctuation">,</span> b<span class="token string">'11110001'</span> <span class="token operator">&</span> b<span class="token string">'01001111'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> X'40' <span class="token punctuation">|</span> X'01' <span class="token punctuation">|</span> b'11110001' & b'01001111' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 65 <span class="token punctuation">|</span> 65 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
These bit operations evaluate the hexadecimal literals and
bit literals as binary strings, due to the
<code class="literal">
_binary
</code>
introducer:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86298604"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'01'</span><span class="token punctuation">,</span> b<span class="token string">'11110001'</span> <span class="token operator">&</span> _binary b<span class="token string">'01001111'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> _binary X'40' <span class="token punctuation">|</span> X'01' <span class="token punctuation">|</span> b'11110001' & _binary b'01001111' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Although the bit operations in both statements produce a result
with a numeric value of 65, the second statement operates in
binary-string context, for which 65 is ASCII
<code class="literal">
A
</code>
.
</p>
<p>
In numeric evaluation context, permitted values of hexadecimal
literal and bit literal arguments have a maximum of 64 bits, as
do results. By contrast, in binary-string evaluation context,
permitted arguments (and results) can exceed 64 bits:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24883901"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'4040404040404040'</span> <span class="token operator">|</span> X<span class="token string">'0102030405060708'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> _binary X'4040404040404040' <span class="token punctuation">|</span> X'0102030405060708' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ABCDEFGH <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
There are several ways to refer to a hexadecimal literal or bit
literal in a bit operation to cause binary-string evaluation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81789723"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">_binary <em class="replaceable">literal</em>
<span class="token datatype">BINARY</span> <em class="replaceable">literal</em>
<span class="token function">CAST</span><span class="token punctuation">(</span><em class="replaceable">literal</em> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Another way to produce binary-string evaluation of hexadecimal
literals or bit literals is to assign them to user-defined
variables, which results in variables that have a binary string
type:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26682218"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@v1</span> <span class="token operator">=</span> X<span class="token string">'40'</span><span class="token punctuation">,</span> <span class="token variable">@v2</span> <span class="token operator">=</span> X<span class="token string">'01'</span><span class="token punctuation">,</span> <span class="token variable">@v3</span> <span class="token operator">=</span> b<span class="token string">'11110001'</span><span class="token punctuation">,</span> <span class="token variable">@v4</span> <span class="token operator">=</span> b<span class="token string">'01001111'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@v1</span> <span class="token operator">|</span> <span class="token variable">@v2</span><span class="token punctuation">,</span> <span class="token variable">@v3</span> <span class="token operator">&</span> <span class="token variable">@v4</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @v1 <span class="token punctuation">|</span> @v2 <span class="token punctuation">|</span> @v3 & @v4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
In binary-string context, bitwise operation arguments must have
the same length or an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69727697"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'0001'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3513 (HY000)<span class="token punctuation">:</span> Binary operands of bitwise
operators must be of equal length</span></code></pre>
</div>
<p>
To satisfy the equal-length requirement, pad the shorter value
with leading zero digits or, if the longer value begins with
leading zero digits and a shorter result value is acceptable,
strip them:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15228806"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'0040'</span> <span class="token operator">|</span> X<span class="token string">'0001'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> _binary X'0040' <span class="token punctuation">|</span> X'0001' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'01'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> _binary X'40' <span class="token punctuation">|</span> X'01' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Padding or stripping can also be accomplished using functions
such as
<a class="link" href="string-functions.html#function_lpad">
<code class="literal">
LPAD()
</code>
</a>
,
<a class="link" href="string-functions.html#function_rpad">
<code class="literal">
RPAD()
</code>
</a>
,
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR()
</code>
</a>
, or
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
. In such cases, the
expression arguments are no longer all literals and
<code class="literal">
_binary
</code>
becomes unnecessary. Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98731702"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LPAD</span><span class="token punctuation">(</span>X<span class="token string">'40'</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> X<span class="token string">'00'</span><span class="token punctuation">)</span> <span class="token operator">|</span> X<span class="token string">'0001'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LPAD(X'40', 2, X'00') <span class="token punctuation">|</span> X'0001' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> X<span class="token string">'40'</span> <span class="token operator">|</span> <span class="token function">SUBSTR</span><span class="token punctuation">(</span>X<span class="token string">'0001'</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> X'40' <span class="token punctuation">|</span> SUBSTR(X'0001', 2, 1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
See also
<a class="xref" href="bit-functions.html#bit-operations-literal-handling" title="Special Handling of Hexadecimal Literals, Bit Literals, and NULL Literals">
Special Handling of Hexadecimal Literals, Bit Literals, and NULL
Literals
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-binary-string-examples">
</a>
Binary String Bit-Operation Examples
</h3>
</div>
</div>
</div>
<p>
The following example illustrates use of bit operations to
extract parts of a UUID value, in this case, the timestamp and
IEEE 802 node number. This technique requires bitmasks for each
extracted part.
</p>
<p>
Convert the text UUID to the corresponding 16-byte binary value
so that it can be manipulated using bit operations in
binary-string context:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41080460"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@uuid</span> <span class="token operator">=</span> <span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(@uuid) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA102695645B8C656024DB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Construct bitmasks for the timestamp and node number parts of
the value. The timestamp comprises the first three parts (64
bits, bits 0 to 63) and the node number is the last part (48
bits, bits 80 to 127):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98506575"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@ts_mask</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span>X<span class="token string">'FFFFFFFFFFFFFFFF'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@node_mask</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span>X<span class="token string">'FFFFFFFFFFFF'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">>></span> <span class="token number">80</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@ts_mask</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(@ts_mask) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> FFFFFFFFFFFFFFFF0000000000000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@node_mask</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(@node_mask) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 00000000000000000000FFFFFFFFFFFF <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The
<code class="literal">
CAST(... AS BINARY(16))
</code>
function is used
here because the masks must be the same length as the UUID value
against which they are applied. The same result can be produced
using other functions to pad the masks to the required length:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12663481"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token variable">@ts_mask</span><span class="token operator">=</span> <span class="token function">RPAD</span><span class="token punctuation">(</span>X<span class="token string">'FFFFFFFFFFFFFFFF'</span> <span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">,</span> X<span class="token string">'00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@node_mask</span> <span class="token operator">=</span> <span class="token function">LPAD</span><span class="token punctuation">(</span>X<span class="token string">'FFFFFFFFFFFF'</span><span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">,</span> X<span class="token string">'00'</span><span class="token punctuation">)</span> <span class="token punctuation">;</span></code></pre>
</div>
<p>
Use the masks to extract the timestamp and node number parts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62070302"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@uuid</span> <span class="token operator">&</span> <span class="token variable">@ts_mask</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'timestamp part'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> timestamp part <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA10260000000000000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@uuid</span> <span class="token operator">&</span> <span class="token variable">@node_mask</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'node part'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> node part <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 000000000000000000005B8C656024DB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The preceding example uses these bit operations: right shift
(
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
)
and bitwise AND
(
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
takes a flag that
causes some bit rearrangement in the resulting binary UUID
value. If you use that flag, modify the extraction masks
accordingly.
</p>
</div>
<p>
The next example uses bit operations to extract the network and
host parts of an IPv6 address. Suppose that the network part has
a length of 80 bits. Then the host part has a length of 128
− 80 = 48 bits. To extract the network and host parts of
the address, convert it to a binary string, then use bit
operations in binary-string context.
</p>
<p>
Convert the text IPv6 address to the corresponding binary
string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa86858814"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@ip</span> <span class="token operator">=</span> <span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'fe80::219:d1ff:fe91:1a72'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Define the network length in bits:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88254949"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@net_len</span> <span class="token operator">=</span> <span class="token number">80</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Construct network and host masks by shifting the all-ones
address left or right. To do this, begin with the address
<code class="literal">
::
</code>
, which is shorthand for all zeros, as you
can see by converting it to a binary string like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78865269"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'all zeros'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> all zeros <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 00000000000000000000000000000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To produce the complementary value (all ones), use the
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
operator to invert the bits:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93727429"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token operator">~</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'all ones'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> all ones <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Shift the all-ones value left or right to produce the network
and host masks:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18715228"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@net_mask</span> <span class="token operator">=</span> <span class="token operator">~</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::'</span><span class="token punctuation">)</span> <span class="token operator"><<</span> <span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">-</span> <span class="token variable">@net_len</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@host_mask</span> <span class="token operator">=</span> <span class="token operator">~</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::'</span><span class="token punctuation">)</span> <span class="token operator">>></span> <span class="token variable">@net_len</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Display the masks to verify that they cover the correct parts of
the address:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20332527"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token variable">@net_mask</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'network mask'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> network mask <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ffff:ffff:ffff:ffff:ffff:: <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token variable">@host_mask</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'host mask'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> host mask <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ::ffff:255.255.255.255 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Extract and display the network and host parts of the address:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24915018"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@net_part</span> <span class="token operator">=</span> <span class="token variable">@ip</span> <span class="token operator">&</span> <span class="token variable">@net_mask</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@host_part</span> <span class="token operator">=</span> <span class="token variable">@ip</span> <span class="token operator">&</span> <span class="token variable">@host_mask</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token variable">@net_part</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'network part'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> network part <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> fe80::219:0:0:0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token variable">@host_part</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'host part'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> host part <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ::d1ff:fe91:1a72 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The preceding example uses these bit operations: Complement
(
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
),
left shift
(
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
),
and bitwise AND
(
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
).
</p>
<p>
The remaining discussion provides details on argument handling
for each group of bit operations, and more information about
literal-value handling in bit operations.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-and-or-xor">
</a>
Bitwise AND, OR, and XOR Operations
</h3>
</div>
</div>
</div>
<p>
For
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_bitwise-or">
<code class="literal">
|
</code>
</a>
, and
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
bit
operations, the result type depends on whether the arguments are
evaluated as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the arguments have a
binary string type, and at least one of them is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation occurs otherwise, with argument
conversion to unsigned 64-bit integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the arguments. If the arguments have unequal
lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned 64-bit
integer.
</p>
</li>
</ul>
</div>
<p>
Examples of numeric evaluation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14402917"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">64</span> <span class="token operator">|</span> <span class="token number">1</span><span class="token punctuation">,</span> X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'01'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 64 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> X'40' <span class="token punctuation">|</span> X'01' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 65 <span class="token punctuation">|</span> 65 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Examples of binary-string evaluation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89656043"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> _binary X<span class="token string">'40'</span> <span class="token operator">|</span> X<span class="token string">'01'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> _binary X'40' <span class="token punctuation">|</span> X'01' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@var1</span> <span class="token operator">=</span> X<span class="token string">'40'</span><span class="token punctuation">,</span> <span class="token variable">@var2</span> <span class="token operator">=</span> X<span class="token string">'01'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@var1</span> <span class="token operator">|</span> <span class="token variable">@var2</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @var1 <span class="token punctuation">|</span> @var2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-complement-shift">
</a>
Bitwise Complement and Shift Operations
</h3>
</div>
</div>
</div>
<p>
For
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
,
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
,
and
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
bit operations, the result type depends on whether the bit
argument is evaluated as a binary string or number:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the bit argument has a
binary string type, and is not a hexadecimal literal, bit
literal, or
<code class="literal">
NULL
</code>
literal. Numeric
evaluation occurs otherwise, with argument conversion to an
unsigned 64-bit integer as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the bit argument. Numeric evaluation produces
an unsigned 64-bit integer.
</p>
</li>
</ul>
</div>
<p>
For shift operations, bits shifted off the end of the value are
lost without warning, regardless of the argument type. In
particular, if the shift count is greater or equal to the number
of bits in the bit argument, all bits in the result are 0.
</p>
<p>
Examples of numeric evaluation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18103397"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">~</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">64</span> <span class="token operator"><<</span> <span class="token number">2</span><span class="token punctuation">,</span> X<span class="token string">'40'</span> <span class="token operator"><<</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ~0 <span class="token punctuation">|</span> 64 << 2 <span class="token punctuation">|</span> X'40' << 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 18446744073709551615 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Examples of binary-string evaluation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41222449"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'1111000022220000'</span> <span class="token operator">>></span> <span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(_binary X'1111000022220000' >> 16) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0000111100002222 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span>_binary X<span class="token string">'1111000022220000'</span> <span class="token operator"><<</span> <span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(_binary X'1111000022220000' << 16) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0000222200000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@var1</span> <span class="token operator">=</span> X<span class="token string">'F0F0F0F0'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token operator">~</span><span class="token variable">@var1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(~@var1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0F0F0F0F <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-bit-count">
</a>
BIT_COUNT() Operations
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="bit-functions.html#function_bit-count">
<code class="literal">
BIT_COUNT()
</code>
</a>
function always
returns an unsigned 64-bit integer, or
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57281743"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span><span class="token number">127</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIT_COUNT(127) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span>b<span class="token string">'010101'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">BIT_COUNT</span><span class="token punctuation">(</span>_binary b<span class="token string">'010101'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> BIT_COUNT(b'010101') <span class="token punctuation">|</span> BIT_COUNT(_binary b'010101') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-bit-aggregate">
</a>
BIT_AND(), BIT_OR(), and BIT_XOR() Operations
</h3>
</div>
</div>
</div>
<p>
For the
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
, and
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
bit functions, the
result type depends on whether the function argument values are
evaluated as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the argument values
have a binary string type, and the argument is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation occurs otherwise, with argument
value conversion to unsigned 64-bit integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the argument values. If argument values have
unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. If the argument size exceeds 511 bytes, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_aggregate_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned 64-bit
integer.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
NULL
</code>
values do not affect the result unless
all values are
<code class="literal">
NULL
</code>
. In that case, the result
is a neutral value having the same length as the length of the
argument values (all bits 1 for
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
, all bits 0 for
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
, and
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
).
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55909496"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>group_id <span class="token datatype">INT</span><span class="token punctuation">,</span> a <span class="token datatype">VARBINARY</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> X<span class="token string">'1234'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> X<span class="token string">'FF34'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">BIT_AND</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">BIT_OR</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">BIT_XOR</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> group_id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(BIT_AND(a)) <span class="token punctuation">|</span> HEX(BIT_OR(a)) <span class="token punctuation">|</span> HEX(BIT_XOR(a)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> FFFFFFFFFFFF <span class="token punctuation">|</span> 000000000000 <span class="token punctuation">|</span> 000000000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1234 <span class="token punctuation">|</span> FF34 <span class="token punctuation">|</span> ED00 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="bit-operations-literal-handling">
</a>
Special Handling of Hexadecimal Literals, Bit Literals, and NULL
Literals
</h3>
</div>
</div>
</div>
<p>
MySQL 8.4 evaluates bit operations in numeric
context when all bit arguments are hexadecimal literals, bit
literals, or
<code class="literal">
NULL
</code>
literals. That is, bit
operations on binary-string bit arguments do not use
binary-string evaluation if all bit arguments are unadorned
hexadecimal literals, bit literals, or
<code class="literal">
NULL
</code>
literals. (This does not apply to such literals if they are
written with a
<code class="literal">
_binary
</code>
introducer,
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
operator, or other way of
specifying them explicitly as binary strings.)
</p>
<p>
Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
These bit operations evaluate the literals in numeric
context and produce a
<code class="literal">
BIGINT
</code>
result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56646294"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">b<span class="token string">'0001'</span> <span class="token operator">|</span> b<span class="token string">'0010'</span>
X<span class="token string">'0008'</span> <span class="token operator"><<</span> <span class="token number">8</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
These bit operations evaluate
<code class="literal">
NULL
</code>
in
numeric context and produce a
<code class="literal">
BIGINT
</code>
result that has a
<code class="literal">
NULL
</code>
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8754588"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token boolean">NULL</span> <span class="token operator">&</span> <span class="token boolean">NULL</span>
<span class="token boolean">NULL</span> <span class="token operator">>></span> <span class="token number">4</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
You can cause those operations to evaluate the arguments in
binary-string context by indicating explicitly that at least one
argument is a binary string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26572225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">_binary b<span class="token string">'0001'</span> <span class="token operator">|</span> b<span class="token string">'0010'</span>
_binary X<span class="token string">'0008'</span> <span class="token operator"><<</span> <span class="token number">8</span>
<span class="token datatype">BINARY</span> <span class="token boolean">NULL</span> <span class="token operator">&</span> <span class="token boolean">NULL</span>
<span class="token datatype">BINARY</span> <span class="token boolean">NULL</span> <span class="token operator">>></span> <span class="token number">4</span></code></pre>
</div>
<p>
The result of the last two expressions is
<code class="literal">
NULL
</code>
, just as without the
<code class="literal">
BINARY
</code>
operator, but the data type of the
result is a binary string type rather than an integer type.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-ce-sets.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-ce-sets">
</a>
12.10.3 Central European Character Sets
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045215921120">
</a>
<a class="indexterm" name="idm46045215919664">
</a>
<p>
MySQL provides some support for character sets used in the Czech
Republic, Slovakia, Hungary, Romania, Slovenia, Croatia, Poland,
and Serbia (Latin).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
cp1250
</code>
(Windows Central European)
collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
cp1250_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1250_croatian_ci
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1250_czech_cs
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1250_general_ci
</code>
(default)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1250_polish_ci
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
cp852
</code>
(DOS Central European) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
cp852_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp852_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
keybcs2
</code>
(DOS Kamenicky Czech-Slovak)
collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
keybcs2_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keybcs2_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
latin2
</code>
(ISO 8859-2 Central European)
collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
latin2_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latin2_croatian_ci
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latin2_czech_cs
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latin2_general_ci
</code>
(default)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latin2_hungarian_ci
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
macce
</code>
(Mac Central European) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
macce_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
macce_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
macce
</code>
is deprecated; expect support for
it to be removed in a subsequent MySQL release.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/compilation-problems.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="compilation-problems">
</a>
2.8.8 Dealing with Problems Compiling MySQL
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045327231168">
</a>
<a class="indexterm" name="idm46045327229712">
</a>
<a class="indexterm" name="idm46045327228224">
</a>
<a class="indexterm" name="idm46045327227152">
</a>
<a class="indexterm" name="idm46045327226080">
</a>
<p>
The solution to many problems involves reconfiguring. If you do
reconfigure, take note of the following:
</p>
<a class="indexterm" name="idm46045327224064">
</a>
<a class="indexterm" name="idm46045327222976">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<span class="command">
<strong>
CMake
</strong>
</span>
is run after it has previously
been run, it may use information that was gathered during its
previous invocation. This information is stored in
<code class="filename">
CMakeCache.txt
</code>
. When
<span class="command">
<strong>
CMake
</strong>
</span>
starts, it looks for that file and
reads its contents if it exists, on the assumption that the
information is still correct. That assumption is invalid when
you reconfigure.
</p>
</li>
<li class="listitem">
<p>
Each time you run
<span class="command">
<strong>
CMake
</strong>
</span>
, you must run
<span class="command">
<strong>
make
</strong>
</span>
again to recompile. However, you may
want to remove old object files from previous builds first
because they were compiled using different configuration
options.
</p>
</li>
</ul>
</div>
<p>
To prevent old object files or configuration information from
being used, run the following commands before re-running
<span class="command">
<strong>
CMake
</strong>
</span>
:
</p>
<p>
On Unix:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa54170404"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">make</span> clean
<span class="token prompt">$> </span><span class="token command">rm</span> CMakeCache<span class="token punctuation">.</span>txt</code></pre>
</div>
<p>
On Windows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38603725"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">devenv</span> MySQL<span class="token punctuation">.</span>sln /clean
<span class="token prompt">$> </span><span class="token command">del</span> CMakeCache<span class="token punctuation">.</span>txt</code></pre>
</div>
<p>
If you build outside of the source tree, remove and recreate your
build directory before re-running
<span class="command">
<strong>
CMake
</strong>
</span>
. For
instructions on building outside of the source tree, see
<a class="ulink" href="/doc/internals/en/cmake.html" target="_top">
How to Build MySQL
Server with CMake
</a>
.
</p>
<p>
On some systems, warnings may occur due to differences in system
include files. The following list describes other problems that
have been found to occur most often when compiling MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045327205024">
</a>
<a class="indexterm" name="idm46045327203952">
</a>
<a class="indexterm" name="idm46045327202496">
</a>
<a class="indexterm" name="idm46045327201408">
</a>
To define which C and C++ compilers to use, you can define the
<code class="literal">
CC
</code>
and
<code class="literal">
CXX
</code>
environment
variables. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa1424336"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">CC</span><span class="token attr-value"><span class="token punctuation">=</span>gcc</span>
<span class="token prompt">$> </span><span class="token command">CXX</span><span class="token attr-value"><span class="token punctuation">=</span>g++</span>
<span class="token prompt">$> </span><span class="token command">export</span> CC CXX</code></pre>
</div>
<p>
While this can be done on the command line, as just shown, you
may prefer to define these values in a build script, in which
case the
<span class="command">
<strong>
export
</strong>
</span>
command is not needed.
</p>
<p>
To specify your own C and C++ compiler flags, use the
<a class="link" href="source-configuration-options.html#option_cmake_cmake_c_flags">
<code class="option">
CMAKE_C_FLAGS
</code>
</a>
and
<a class="link" href="source-configuration-options.html#option_cmake_cmake_cxx_flags">
<code class="option">
CMAKE_CXX_FLAGS
</code>
</a>
CMake options.
See
<a class="xref" href="source-configuration-options.html#cmake-compiler-flags" title="Compiler Flags">
Compiler Flags
</a>
.
</p>
<p>
To see what flags you might need to specify, invoke
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
with the
<a class="link" href="mysql-config.html#option_mysql_config_cflags">
<code class="option">
--cflags
</code>
</a>
and
<a class="link" href="mysql-config.html#option_mysql_config_cxxflags">
<code class="option">
--cxxflags
</code>
</a>
options.
</p>
</li>
<li class="listitem">
<p>
To see what commands are executed during the compile stage,
after using
<span class="command">
<strong>
CMake
</strong>
</span>
to configure MySQL, run
<span class="command">
<strong>
make VERBOSE=1
</strong>
</span>
rather than just
<span class="command">
<strong>
make
</strong>
</span>
.
</p>
</li>
<li class="listitem">
<p>
If compilation fails, check whether the
<a class="link" href="source-configuration-options.html#option_cmake_mysql_maintainer_mode">
<code class="option">
MYSQL_MAINTAINER_MODE
</code>
</a>
option is
enabled. This mode causes compiler warnings to become errors,
so disabling it may enable compilation to proceed.
</p>
</li>
<li class="listitem">
<p>
If your compile fails with errors such as any of the
following, you must upgrade your version of
<span class="command">
<strong>
make
</strong>
</span>
to GNU
<span class="command">
<strong>
make
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa672357"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">make<span class="token operator">:</span> Fatal error in reader<span class="token operator">:</span> Makefile<span class="token punctuation">,</span> line 18<span class="token operator">:</span>
Badly formed macro assignment</code></pre>
</div>
<p>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa80210457"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">make<span class="token operator">:</span> file `Makefile' line 18<span class="token operator">:</span> Must be a separator <span class="token punctuation">(</span><span class="token operator">:</span></code></pre>
</div>
<p>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa71403045"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">pthread<span class="token punctuation">.</span>h<span class="token operator">:</span> No such file or directory</code></pre>
</div>
<a class="indexterm" name="idm46045327175440">
</a>
<a class="indexterm" name="idm46045327174368">
</a>
<p>
Solaris and FreeBSD are known to have troublesome
<span class="command">
<strong>
make
</strong>
</span>
programs.
</p>
<p>
GNU
<span class="command">
<strong>
make
</strong>
</span>
3.75 is known to work.
</p>
</li>
<li class="listitem">
<p>
The
<code class="filename">
sql_yacc.cc
</code>
file is generated from
<code class="filename">
sql_yacc.yy
</code>
. Normally, the build process
does not need to create
<code class="filename">
sql_yacc.cc
</code>
because MySQL comes with a pregenerated copy. However, if you
do need to re-create it, you might encounter this error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa4001456"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">"sql_yacc<span class="token punctuation">.</span>yy"<span class="token punctuation">,</span> line <em class="replaceable">xxx</em> fatal<span class="token operator">:</span> default action causes potential<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
This is a sign that your version of
<span class="command">
<strong>
yacc
</strong>
</span>
is
deficient. You probably need to install a recent version of
<span class="command">
<strong>
bison
</strong>
</span>
(the GNU version of
<span class="command">
<strong>
yacc
</strong>
</span>
) and use that instead.
</p>
<p>
Versions of
<span class="command">
<strong>
bison
</strong>
</span>
older than 1.75 may
report this error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa99799362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">sql_yacc<span class="token punctuation">.</span>yy<span class="token operator">:</span><span class="token comment" spellcheck="true">#####: fatal error: maximum table size (32767) exceeded</span></code></pre>
</div>
<p>
The maximum table size is not actually exceeded; the error is
caused by bugs in older versions of
<span class="command">
<strong>
bison
</strong>
</span>
.
</p>
</li>
</ul>
</div>
<p>
For information about acquiring or updating tools, see the system
requirements in
<a class="xref" href="source-installation.html" title="2.8 Installing MySQL from Source">
Section 2.8, “Installing MySQL from Source”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-compatibility.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-compatibility">
</a>
19.5.2 Replication Compatibility Between MySQL Versions
</h3>
</div>
</div>
</div>
<p>
MySQL supports replication from an older source to a newer replica
for version combinations where we support upgrades from the source
version to the replica version as described at
<a class="xref" href="mysql-releases.html" title="1.3 MySQL Releases: Innovation and LTS">
Section 1.3, “MySQL Releases: Innovation and LTS”
</a>
and
<a class="xref" href="upgrade-paths.html" title="3.2 Upgrade Paths">
Section 3.2, “Upgrade Paths”
</a>
. However, you might encounter
difficulties when replicating from an older source to a newer
replica if the source uses statements or relies on behavior no
longer supported in the version of MySQL used on the replica.
</p>
<p>
The use of more than two MySQL Server versions is not supported in
replication setups involving multiple sources, regardless of the
number of source or replica MySQL servers. For example, if you are
using a chained or circular replication setup, you cannot use
MySQL X.Y.1, MySQL X.Y.2, and MySQL X.Y.3 concurrently, although
you could use any two of these releases together.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
It is strongly recommended to use the most recent release
available within a given MySQL release series because
replication (and other) capabilities are continually being
improved. It is also recommended to upgrade sources and replicas
that use early releases of a release series of MySQL to GA
(production) releases when the latter become available for that
release series.
</p>
</div>
<p>
The server version is recorded in the binary log for each
transaction for the server that originally committed the
transaction
(
<a class="link" href="replication-options-source.html#sysvar_original_server_version">
<code class="literal">
original_server_version
</code>
</a>
), and
for the server that is the immediate source of the current server
in the replication topology
(
<a class="link" href="replication-options-source.html#sysvar_immediate_server_version">
<code class="literal">
immediate_server_version
</code>
</a>
).
</p>
<p>
Replication from newer sources to older replicas might be
possible, but is generally not supported. This is due to a number
of factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Binary log format changes.
</b>
The binary log format can change between major releases.
While we attempt to maintain backward compatibility, this is
not always possible. A source might also have optional
features enabled that are not understood by older replicas,
such as binary log transaction compression, where the
resulting compressed transaction payloads cannot be read by
a replica from a release prior to MySQL 8.0.20.
</p>
<p>
This also has significant implications for upgrading
replication servers; see
<a class="xref" href="replication-upgrade.html" title="19.5.3 Upgrading or Downgrading a Replication Topology">
Section 19.5.3, “Upgrading or Downgrading a Replication Topology”
</a>
, for more information.
</p>
</li>
<li class="listitem">
<p>
<b>
SQL incompatibilities.
</b>
You cannot replicate from a newer source to an older replica
using statement-based replication if the statements to be
replicated use SQL features available on the source but not
on the replica.
</p>
<p>
However, if both the source and the replica support row-based
replication, and there are no data definition statements to be
replicated that depend on SQL features found on the source but
not on the replica, you can use row-based replication to
replicate the effects of data modification statements even if
the DDL run on the source is not supported on the replica.
</p>
<p>
For more information about row-based replication, see
<a class="xref" href="replication-formats.html" title="19.2.1 Replication Formats">
Section 19.2.1, “Replication Formats”
</a>
.
</p>
</li>
</ul>
</div>
<p>
For more information on potential replication issues, see
<a class="xref" href="replication-features.html" title="19.5.1 Replication Features and Issues">
Section 19.5.1, “Replication Features and Issues”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/programs.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="programs">
</a>
Chapter 6 MySQL Programs
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="programs-overview.html">
6.1 Overview of MySQL Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="programs-using.html">
6.2 Using MySQL Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="invoking-programs.html">
6.2.1 Invoking MySQL Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="program-options.html">
6.2.2 Specifying Program Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-options.html">
6.2.3 Command Options for Connecting to the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting.html">
6.2.4 Connecting to the MySQL Server Using Command Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting-using-uri-or-key-value-pairs.html">
6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting-using-dns-srv.html">
6.2.6 Connecting to the Server Using DNS SRV Records
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="transport-protocols.html">
6.2.7 Connection Transport Protocols
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-compression-control.html">
6.2.8 Connection Compression Control
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="setting-environment-variables.html">
6.2.9 Setting Environment Variables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-server.html">
6.3 Server and Server-Startup Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysqld.html">
6.3.1 mysqld — The MySQL Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqld-safe.html">
6.3.2 mysqld_safe — MySQL Server Startup Script
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-server.html">
6.3.3 mysql.server — MySQL Server Startup Script
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqld-multi.html">
6.3.4 mysqld_multi — Manage Multiple MySQL Servers
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-installation.html">
6.4 Installation-Related Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="comp-err.html">
6.4.1 comp_err — Compile MySQL Error Message File
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-secure-installation.html">
6.4.2 mysql_secure_installation — Improve MySQL Installation Security
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-tzinfo-to-sql.html">
6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-client.html">
6.5 Client Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql.html">
6.5.1 mysql — The MySQL Command-Line Client
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqladmin.html">
6.5.2 mysqladmin — A MySQL Server Administration Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlcheck.html">
6.5.3 mysqlcheck — A Table Maintenance Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldump.html">
6.5.4 mysqldump — A Database Backup Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlimport.html">
6.5.5 mysqlimport — A Data Import Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlshow.html">
6.5.6 mysqlshow — Display Database, Table, and Column Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlslap.html">
6.5.7 mysqlslap — A Load Emulation Client
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-admin-utils.html">
6.6 Administrative and Utility Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ibd2sdi.html">
6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innochecksum.html">
6.6.2 innochecksum — Offline InnoDB File Checksum Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-ftdump.html">
6.6.3 myisam_ftdump — Display Full-Text Index information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk.html">
6.6.4 myisamchk — MyISAM Table-Maintenance Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamlog.html">
6.6.5 myisamlog — Display MyISAM Log File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisampack.html">
6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-config-editor.html">
6.6.7 mysql_config_editor — MySQL Configuration Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-migrate-keyring.html">
6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlbinlog.html">
6.6.9 mysqlbinlog — Utility for Processing Binary Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldumpslow.html">
6.6.10 mysqldumpslow — Summarize Slow Query Log Files
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-development.html">
6.7 Program Development Utilities
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-config.html">
6.7.1 mysql_config — Display Options for Compiling Clients
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="my-print-defaults.html">
6.7.2 my_print_defaults — Display Options from Option Files
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-miscellaneous.html">
6.8 Miscellaneous Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="perror.html">
6.8.1 perror — Display MySQL Error Message Information
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="environment-variables.html">
6.9 Environment Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="unix-signal-response.html">
6.10 Unix Signal Handling in MySQL
</a>
</span>
</dt>
</dl>
</div>
<p>
This chapter provides a brief overview of the MySQL command-line
programs provided by Oracle Corporation. It also discusses the
general syntax for specifying options when you run these programs.
Most programs have options that are specific to their own operation,
but the option syntax is similar for all of them. Finally, the
chapter provides more detailed descriptions of individual programs,
including which options they recognize.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/parenthesized-query-expressions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="parenthesized-query-expressions">
</a>
15.2.11 Parenthesized Query Expressions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045181236336">
</a>
<a class="indexterm" name="idm46045181235248">
</a>
<a class="indexterm" name="idm46045181233744">
</a>
<a class="indexterm" name="idm46045181232240">
</a>
<a class="indexterm" name="idm46045181230736">
</a>
<a class="indexterm" name="idm46045181229232">
</a>
<a class="indexterm" name="idm46045181227728">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16844814"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><em class="replaceable">parenthesized_query_expression</em>:
<span class="token punctuation">(</span> <em class="replaceable">query_expression</em> <span class="token punctuation">[</span><em class="replaceable">order_by_clause</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">limit_clause</em><span class="token punctuation">]</span> <span class="token punctuation">)</span>
<span class="token punctuation">[</span><em class="replaceable">order_by_clause</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><em class="replaceable">limit_clause</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><em class="replaceable">into_clause</em><span class="token punctuation">]</span>
<em class="replaceable">query_expression</em>:
<em class="replaceable">query_block</em> <span class="token punctuation">[</span><em class="replaceable">set_op</em> <em class="replaceable">query_block</em> <span class="token punctuation">[</span><em class="replaceable">set_op</em> <em class="replaceable">query_block</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><em class="replaceable">order_by_clause</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><em class="replaceable">limit_clause</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><em class="replaceable">into_clause</em><span class="token punctuation">]</span>
<em class="replaceable">query_block</em>:
<span class="token keyword">SELECT</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token operator">|</span> <span class="token keyword">TABLE</span> <span class="token operator">|</span> <span class="token keyword">VALUES</span>
<em class="replaceable">order_by_clause</em>:
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token keyword">as</span> <span class="token keyword">for</span> <span class="token keyword">SELECT</span>
<em class="replaceable">limit_clause</em>:
<span class="token keyword">LIMIT</span> <span class="token keyword">as</span> <span class="token keyword">for</span> <span class="token keyword">SELECT</span>
<em class="replaceable">into_clause</em>:
<span class="token keyword">INTO</span> <span class="token keyword">as</span> <span class="token keyword">for</span> <span class="token keyword">SELECT</span>
<em class="replaceable">set_op</em>:
<span class="token keyword">UNION</span> <span class="token operator">|</span> <span class="token keyword">INTERSECT</span> <span class="token operator">|</span> <span class="token keyword">EXCEPT</span></code></pre>
</div>
<p>
MySQL 8.4 supports parenthesized query expressions
according to the preceding syntax. At its simplest, a
parenthesized query expression contains a single
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
or other statement returning
a result set and no following optional clauses:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53438008"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>SCHEMATA <span class="token keyword">WHERE</span> <span class="token keyword">SCHEMA_NAME</span> <span class="token operator">=</span> <span class="token string">'mysql'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">TABLE</span> t<span class="token punctuation">;</span>
<span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A parenthesized query expression can also contain queries linked
by one or more set operations such as
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
, and end with any or all of
the optional clauses:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23278125"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> result <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> result <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span> <span class="token keyword">OFFSET</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> result <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> result <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> result <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> result <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span> <span class="token keyword">OFFSET</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> result <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">AS</span> result <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">3</span> <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span><span class="token punctuation">)</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> result <span class="token keyword">LIMIT</span> <span class="token number">1</span> <span class="token keyword">OFFSET</span> <span class="token number">1</span> <span class="token keyword">INTO</span> <span class="token variable">@var</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@var</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @var <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
<code class="literal">
INTERSECT
</code>
acts before
<code class="literal">
UNION
</code>
and
<code class="literal">
EXCEPT
</code>
, so that the following two
statements are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95376996"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> a <span class="token keyword">FROM</span> t1 <span class="token keyword">EXCEPT</span> <span class="token keyword">SELECT</span> b <span class="token keyword">FROM</span> t2 <span class="token keyword">INTERSECT</span> <span class="token keyword">SELECT</span> c <span class="token keyword">FROM</span> t3<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> a <span class="token keyword">FROM</span> t1 <span class="token keyword">EXCEPT</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> b <span class="token keyword">FROM</span> t2 <span class="token keyword">INTERSECT</span> <span class="token keyword">SELECT</span> c <span class="token keyword">FROM</span> t3<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Parenthesized query expressions are also used as query
expressions, so a query expression, usually composed of query
blocks, may also consist of parenthesized query expressions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21321631"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span><span class="token keyword">TABLE</span> t1 <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> a<span class="token punctuation">)</span> <span class="token keyword">UNION</span> <span class="token punctuation">(</span><span class="token keyword">TABLE</span> t2 <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> b<span class="token punctuation">)</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> z<span class="token punctuation">;</span></code></pre>
</div>
<p>
Query blocks may have trailing
<code class="literal">
ORDER BY
</code>
and
<code class="literal">
LIMIT
</code>
clauses, which are applied before the
outer set operation,
<code class="literal">
ORDER BY
</code>
, and
<code class="literal">
LIMIT
</code>
.
</p>
<p>
You cannot have a query block with a trailing
<code class="literal">
ORDER
BY
</code>
or
<code class="literal">
LIMIT
</code>
without wrapping it in
parentheses but parentheses may be used for enforcement in various
ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To enforce
<code class="literal">
LIMIT
</code>
on each query block:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37238856"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">UNION</span> <span class="token punctuation">(</span><span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">(</span><span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">EXCEPT</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To enforce
<code class="literal">
LIMIT
</code>
on both query blocks and
the entire query expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa28718545"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">UNION</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To enforce
<code class="literal">
LIMIT
</code>
on the entire query
expression (with no parentheses):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa26046936"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">INTERSECT</span> <span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Hybrid enforcement:
<code class="literal">
LIMIT
</code>
on the first
query block and on the entire query expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53613336"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The syntax described in this section is subject to certain
restrictions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A trailing
<code class="literal">
INTO
</code>
clause for a query
expression is not permitted if there is another
<code class="literal">
INTO
</code>
clause inside parentheses.
</p>
</li>
<li class="listitem">
<p>
An
<code class="literal">
ORDER BY
</code>
or
<code class="literal">
LIMIT
</code>
within a parenthesized query expression which is also applied
in the outer query is handled in accordance with the SQL
standard.
</p>
<p>
Nested parenthesized query expressions are permitted. The
maximum level of nesting supported is 63; this is after any
simplifications or merges have been performed by the parser.
</p>
<p>
An example of such a statement is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18465339"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token string">'a'</span> <span class="token keyword">UNION</span> <span class="token keyword">SELECT</span> <span class="token string">'b'</span> <span class="token keyword">LIMIT</span> <span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">LIMIT</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
You should be aware that, when collapsing parenthesized
expression bodies, MySQL follows SQL standard semantics, so
that a higher outer limit cannot override an inner lower one.
For example,
<code class="literal">
(SELECT ... LIMIT 5) LIMIT 10
</code>
can return no more than five rows.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-option-variable-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-option-variable-reference">
</a>
7.6.7.12 Clone System Variable Reference
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255127552">
</a>
<div class="table">
<a name="idm46045255126064">
</a>
<p class="title">
<b>
Table 7.7 Clone System Variable Reference
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Reference for clone command-line options, system variables, and status variables. Clone variables are configured on the recipient MySQL server instance where the cloning operation is executed.">
<colgroup>
<col style="width: 20%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Name
</th>
<th scope="col">
Cmd-Line
</th>
<th scope="col">
Option File
</th>
<th scope="col">
System Var
</th>
<th scope="col">
Status Var
</th>
<th scope="col">
Var Scope
</th>
<th scope="col">
Dynamic
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_autotune_concurrency">
clone_autotune_concurrency
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_block_ddl">
clone_block_ddl
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_buffer_size">
clone_buffer_size
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ddl_timeout">
clone_ddl_timeout
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_delay_after_data_drop">
clone_delay_after_data_drop
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_donor_timeout_after_network_failure">
clone_donor_timeout_after_network_failure
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_enable_compression">
clone_enable_compression
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_max_concurrency">
clone_max_concurrency
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_max_data_bandwidth">
clone_max_data_bandwidth
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_max_network_bandwidth">
clone_max_network_bandwidth
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_ca">
clone_ssl_ca
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_cert">
clone_ssl_cert
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_key">
clone_ssl_key
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
clone_valid_donor_list
</a>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
<td>
Global
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th scope="col" style="width: 316.688px;">
Name
</th>
<th scope="col" style="width: 64.8281px;">
Cmd-Line
</th>
<th scope="col" style="width: 73.3125px;">
Option File
</th>
<th scope="col" style="width: 75.0625px;">
System Var
</th>
<th scope="col" style="width: 70.7031px;">
Status Var
</th>
<th scope="col" style="width: 68.0781px;">
Var Scope
</th>
<th scope="col" style="width: 69.3281px;">
Dynamic
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-functions-async-failover.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-functions-async-failover">
</a>
14.18.3 Asynchronous Replication Channel Failover Functions
</h3>
</div>
</div>
</div>
<p>
The following functions enable you to add or remove replication
source servers to or from the source list for a replication
channel, as well as clear the source list for a given server.
</p>
<div class="table">
<a name="idm46045193598464">
</a>
<p class="title">
<b>
Table 14.27 Failover Channel Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists functions used for controlling asynchronous failover for a given channel or server.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed">
<code class="literal">
asynchronous_connection_failover_add_managed()
</code>
</a>
</td>
<td>
Add group member source server configuration information to a
replication channel source list
</td>
</tr>
<tr>
<td>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source">
<code class="literal">
asynchronous_connection_failover_add_source()
</code>
</a>
</td>
<td>
Add source server configuration information server to a
replication channel source list
</td>
</tr>
<tr>
<td>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-managed">
<code class="literal">
asynchronous_connection_failover_delete_managed()
</code>
</a>
</td>
<td>
Remove a managed group from a replication channel source list
</td>
</tr>
<tr>
<td>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source">
<code class="literal">
asynchronous_connection_failover_delete_source()
</code>
</a>
</td>
<td>
Remove a source server from a replication channel source list
</td>
</tr>
<tr>
<td>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-reset">
<code class="literal">
asynchronous_connection_failover_reset()
</code>
</a>
</td>
<td>
Remove all settings relating to group replication asynchronous
failover
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The asynchronous connection failover mechanism automatically
establishes an asynchronous (source to replica) replication
connection to a new source from the appropriate list after the
existing connection from the replica to its source fails. The
connection is also changed if the currently connected source
does not have the highest weighted priority in the group. For
Group Replication source servers that are defined as part of a
managed group, the connection is also failed over to another
group member if the currently connected source leaves the group
or is no longer in the majority. For more information on the
mechanism, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
<p>
Source lists are stored in the
<code class="literal">
mysql.replication_asynchronous_connection_failover
</code>
and
<code class="literal">
mysql.replication_asynchronous_connection_failover_managed
</code>
tables, and can be viewed in the Performance Schema
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-table.html" title="29.12.11.8 The replication_asynchronous_connection_failover Table">
<code class="literal">
replication_asynchronous_connection_failover
</code>
</a>
table.
</p>
<p>
If the replication channel is on a Group Replication primary for
a group where failover between replicas is active, the source
list is broadcast to all the group members when they join or
when it is updated by any method. Failover between replicas is
controlled by the
<code class="literal">
mysql_start_failover_channels_if_primary
</code>
member action, which is enabled by default, and can be disabled
using the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action
</code>
</a>
function.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="function_asynchronous-connection-failover-add-managed">
</a>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed">
<code class="literal">
asynchronous_connection_failover_add_managed()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193565584">
</a>
<a class="indexterm" name="idm46045193564480">
</a>
<p>
Add configuration information for a replication source
server that is part of a managed group (a Group Replication
group member) to the source list for a replication channel.
You only need to add one group member. The replica
automatically adds the rest from the current group
membership, then keeps the source list updated in line with
membership change.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa23022766"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token function">asynchronous_connection_failover_add_managed</span><span class="token punctuation">(</span><em class="replaceable">channel</em><span class="token punctuation">,</span> <em class="replaceable">managed_type</em><span class="token punctuation">,</span> <em class="replaceable">managed_name</em><span class="token punctuation">,</span> <em class="replaceable">host</em><span class="token punctuation">,</span> <em class="replaceable">port</em><span class="token punctuation">,</span> <em class="replaceable">network_namespace</em><span class="token punctuation">,</span> <em class="replaceable">primary_weight</em><span class="token punctuation">,</span> <em class="replaceable">secondary_weight</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
channel
</code>
</em>
: The replication
channel for which this replication source server is part
of the source list.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
managed_type
</code>
</em>
: The type of
managed service that the asynchronous connection
failover mechanism must provide for this server. The
only value currently accepted is
<code class="literal">
GroupReplication
</code>
.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
managed_name
</code>
</em>
: The identifier
for the managed group that the server is a part of. For
the
<code class="literal">
GroupReplication
</code>
managed service,
the identifier is the value of the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_name">
<code class="literal">
group_replication_group_name
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
host
</code>
</em>
: The host name for this
replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
port
</code>
</em>
: The port number for
this replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
network_namespace
</code>
</em>
: The
network namespace for this replication source server.
Specify an empty string, as this parameter is reserved
for future use.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
primary_weight
</code>
</em>
: The priority
of this replication source server in the replication
channel's source list when it is acting as the primary
for the managed group. The weight is from 1 to 100, with
100 being the highest. For the primary, 80 is a suitable
weight. The asynchronous connection failover mechanism
activates if the currently connected source is not the
highest weighted in the group. Assuming that you set up
the managed group to give a higher weight to a primary
and a lower weight to a secondary, when the primary
changes, its weight increases, and the replica changes
over the connection to it.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
secondary_weight
</code>
</em>
: The
priority of this replication source server in the
replication channel's source list when it is acting as a
secondary in the managed group. The weight is from 1 to
100, with 100 being the highest. For a secondary, 60 is
a suitable weight.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for example
whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49831366"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> asynchronous_connection_failover_add_managed<span class="token punctuation">(</span><span class="token string">'channel2'</span><span class="token punctuation">,</span> <span class="token string">'GroupReplication'</span><span class="token punctuation">,</span> <span class="token string">'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'</span><span class="token punctuation">,</span> <span class="token string">'127.0.0.1'</span><span class="token punctuation">,</span> <span class="token number">3310</span><span class="token punctuation">,</span> <span class="token string">''</span><span class="token punctuation">,</span> <span class="token number">80</span><span class="token punctuation">,</span> <span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> asynchronous_connection_failover_add_source('channel2', 'GroupReplication', 'aaaaaaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaaaaaaaaaa', '127.0.0.1', 3310, '', 80, 60) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Source managed configuration details successfully inserted. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_asynchronous-connection-failover-add-source">
</a>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source">
<code class="literal">
asynchronous_connection_failover_add_source()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193535456">
</a>
<a class="indexterm" name="idm46045193534352">
</a>
<p>
Add configuration information for a replication source
server to the source list for a replication channel.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa25394881"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token function">asynchronous_connection_failover_add_source</span><span class="token punctuation">(</span><em class="replaceable">channel</em><span class="token punctuation">,</span> <em class="replaceable">host</em><span class="token punctuation">,</span> <em class="replaceable">port</em><span class="token punctuation">,</span> <em class="replaceable">network_namespace</em><span class="token punctuation">,</span> <em class="replaceable">weight</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
channel
</code>
</em>
: The replication
channel for which this replication source server is part
of the source list.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
host
</code>
</em>
: The host name for this
replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
port
</code>
</em>
: The port number for
this replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
network_namespace
</code>
</em>
: The
network namespace for this replication source server.
Specify an empty string, as this parameter is reserved
for future use.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
weight
</code>
</em>
: The priority of this
replication source server in the replication channel's
source list. The priority is from 1 to 100, with 100
being the highest, and 50 being the default. When the
asynchronous connection failover mechanism activates,
the source with the highest priority setting among the
alternative sources listed in the source list for the
channel is chosen for the first connection attempt. If
this attempt does not work, the replica tries with all
the listed sources in descending order of priority, then
starts again from the highest priority source. If
multiple sources have the same priority, the replica
orders them randomly. The asynchronous connection
failover mechanism activates if the source currently
connected is not the highest weighted in the group.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for example
whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67104514"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> asynchronous_connection_failover_add_source<span class="token punctuation">(</span><span class="token string">'channel2'</span><span class="token punctuation">,</span> <span class="token string">'127.0.0.1'</span><span class="token punctuation">,</span> <span class="token number">3310</span><span class="token punctuation">,</span> <span class="token string">''</span><span class="token punctuation">,</span> <span class="token number">80</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> asynchronous_connection_failover_add_source('channel2', '127.0.0.1', 3310, '', 80) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Source configuration details successfully inserted. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_asynchronous-connection-failover-delete-managed">
</a>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-managed">
<code class="literal">
asynchronous_connection_failover_delete_managed()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193514240">
</a>
<a class="indexterm" name="idm46045193513200">
</a>
<p>
Remove an entire managed group from the source list for a
replication channel. When you use this function, all the
replication source servers defined in the managed group are
removed from the channel's source list.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa26815185"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token function">asynchronous_connection_failover_delete_managed</span><span class="token punctuation">(</span><em class="replaceable">channel</em><span class="token punctuation">,</span> <em class="replaceable">managed_name</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
channel
</code>
</em>
: The replication
channel for which this replication source server was
part of the source list.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
managed_name
</code>
</em>
: The identifier
for the managed group that the server is a part of. For
the
<code class="literal">
GroupReplication
</code>
managed service,
the identifier is the value of the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_name">
<code class="literal">
group_replication_group_name
</code>
</a>
system variable.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for example
whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91388298"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> asynchronous_connection_failover_delete_managed<span class="token punctuation">(</span><span class="token string">'channel2'</span><span class="token punctuation">,</span> <span class="token string">'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> asynchronous_connection_failover_delete_managed('channel2', 'aaaaaaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaa<span class="token punctuation">-</span>aaaaaaaaaaaa') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Source managed configuration details successfully deleted. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_asynchronous-connection-failover-delete-source">
</a>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source">
<code class="literal">
asynchronous_connection_failover_delete_source()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193495952">
</a>
<a class="indexterm" name="idm46045193494832">
</a>
<p>
Remove configuration information for a replication source
server from the source list for a replication channel.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa59308914"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token function">asynchronous_connection_failover_delete_source</span><span class="token punctuation">(</span><em class="replaceable">channel</em><span class="token punctuation">,</span> <em class="replaceable">host</em><span class="token punctuation">,</span> <em class="replaceable">port</em><span class="token punctuation">,</span> <em class="replaceable">network_namespace</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
channel
</code>
</em>
: The replication
channel for which this replication source server was
part of the source list.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
host
</code>
</em>
: The host name for this
replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
port
</code>
</em>
: The port number for
this replication source server.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
network_namespace
</code>
</em>
: The
network namespace for this replication source server.
Specify an empty string, as this parameter is reserved
for future use.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for example
whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34564938"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> asynchronous_connection_failover_delete_source<span class="token punctuation">(</span><span class="token string">'channel2'</span><span class="token punctuation">,</span> <span class="token string">'127.0.0.1'</span><span class="token punctuation">,</span> <span class="token number">3310</span><span class="token punctuation">,</span> <span class="token string">''</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> asynchronous_connection_failover_delete_source('channel2', '127.0.0.1', 3310, '') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Source configuration details successfully deleted. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_asynchronous-connection-failover-reset">
</a>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-reset">
<code class="literal">
asynchronous_connection_failover_reset()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193476384">
</a>
<a class="indexterm" name="idm46045193475280">
</a>
<p>
Remove all settings relating to the asynchronous connection
failover mechanism. The function clears the Performance
Schema tables
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-table.html" title="29.12.11.8 The replication_asynchronous_connection_failover Table">
<code class="literal">
replication_asynchronous_connection_failover
</code>
</a>
and
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-managed-table.html" title="29.12.11.9 The replication_asynchronous_connection_failover_managed Table">
<code class="literal">
replication_asynchronous_connection_failover_managed
</code>
</a>
.
</p>
<p>
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-reset">
<code class="literal">
asynchronous_connection_failover_reset()
</code>
</a>
can be used only on a server that is not currently part of a
group, and that does not have any replication channels
running. You can use this function to clean up a server that
is no longer being used in a managed group.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa69688172"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike">STRING <span class="token function">asynchronous_connection_failover_reset</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<p>
None.
</p>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for example
whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57978565"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> asynchronous_connection_failover_reset<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> asynchronous_connection_failover_reset() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> The UDF asynchronous_connection_failover_reset() executed successfully. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-compression-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-information-schema-compression-tables">
</a>
17.15.1 InnoDB INFORMATION_SCHEMA Tables about Compression
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-information-schema-innodb_cmp.html">
17.15.1.1 INNODB_CMP and INNODB_CMP_RESET
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-innodb_cmpmem.html">
17.15.1.2 INNODB_CMPMEM and INNODB_CMPMEM_RESET
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-examples-compression-sect.html">
17.15.1.3 Using the Compression Information Schema Tables
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045151411840">
</a>
<p>
There are two pairs of
<code class="literal">
InnoDB
</code>
<code class="literal">
INFORMATION_SCHEMA
</code>
tables about compression
that can provide insight into how well compression is working
overall:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP
</code>
</a>
and
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP_RESET
</code>
</a>
provide
information about the number of compression operations and the
amount of time spent performing compression.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INNODB_CMPMEM
</code>
</a>
and
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INNODB_CMPMEM_RESET
</code>
</a>
provide
information about the way memory is allocated for compression.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-firewall-groups-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-firewall-groups-table">
</a>
29.12.17.1 The firewall_groups Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045069587648">
</a>
<a class="indexterm" name="idm46045069586160">
</a>
<p>
The
<a class="link" href="performance-schema-firewall-groups-table.html" title="29.12.17.1 The firewall_groups Table">
<code class="literal">
firewall_groups
</code>
</a>
table
provides a view into the in-memory data cache for MySQL Enterprise Firewall. It
lists names and operational modes of registered firewall group
profiles. It is used in conjunction with the
<code class="literal">
mysql.firewall_groups
</code>
system table that
provides persistent storage of firewall data; see
<a class="xref" href="firewall-reference.html#firewall-tables" title="MySQL Enterprise Firewall Tables">
MySQL Enterprise Firewall Tables
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-firewall-groups-table.html" title="29.12.17.1 The firewall_groups Table">
<code class="literal">
firewall_groups
</code>
</a>
table has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NAME
</code>
</p>
<p>
The group profile name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MODE
</code>
</p>
<p>
The current operational mode for the profile. Permitted
mode values are
<code class="literal">
OFF
</code>
,
<code class="literal">
DETECTING
</code>
,
<code class="literal">
PROTECTING
</code>
, and
<code class="literal">
RECORDING
</code>
. For details about their
meanings, see
<a class="xref" href="firewall-usage.html#firewall-concepts" title="Firewall Concepts">
Firewall Concepts
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
USERHOST
</code>
</p>
<p>
The training account for the group profile, to be used
when the profile is in
<code class="literal">
RECORDING
</code>
mode.
The value is
<code class="literal">
NULL
</code>
, or a
non-
<code class="literal">
NULL
</code>
account that has the format
<code class="literal">
<em class="replaceable">
<code>
user_name
</code>
</em>
@
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the value is
<code class="literal">
NULL
</code>
, the firewall
records allowlist rules for statements received from
any account that is a member of the group.
</p>
</li>
<li class="listitem">
<p>
If the value is non-
<code class="literal">
NULL
</code>
, the
firewall records allowlist rules only for statements
received from the named account (which should be a
member of the group).
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-firewall-groups-table.html" title="29.12.17.1 The firewall_groups Table">
<code class="literal">
firewall_groups
</code>
</a>
table has no
indexes.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-firewall-groups-table.html" title="29.12.17.1 The firewall_groups Table">
<code class="literal">
firewall_groups
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-version.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-version">
</a>
30.4.3.47 The version View
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061808560">
</a>
<a class="indexterm" name="idm46045061807072">
</a>
<p>
This view provides the current
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema and MySQL server
versions.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This view is deprecated, and subject to removal in a future
MySQL version. Applications that use it should be migrated
to use an alternative instead. For example, use the
<a class="link" href="information-functions.html#function_version">
<code class="literal">
VERSION()
</code>
</a>
function to
retrieve the MySQL server version.
</p>
</div>
<p>
The
<a class="link" href="sys-version.html" title="30.4.3.47 The version View">
<code class="literal">
version
</code>
</a>
view has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
sys_version
</code>
</p>
<p>
The
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema version.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql_version
</code>
</p>
<p>
The MySQL server version.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/aggregate-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="aggregate-functions">
</a>
14.19.1 Aggregate Function Descriptions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045193394656">
</a>
<a class="indexterm" name="idm46045193393616">
</a>
<a class="indexterm" name="idm46045193392128">
</a>
<a class="indexterm" name="idm46045193391056">
</a>
<a class="indexterm" name="idm46045193389568">
</a>
<p>
This section describes aggregate functions that operate on sets
of values. They are often used with a
<code class="literal">
GROUP
BY
</code>
clause to group values into subsets.
</p>
<div class="table">
<a name="idm46045193386800">
</a>
<p class="title">
<b>
Table 14.29 Aggregate Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists aggregate functions.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
</td>
<td>
Return the average value of the argument
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
</td>
<td>
Return bitwise AND
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
</td>
<td>
Return bitwise OR
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
</td>
<td>
Return bitwise XOR
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
</td>
<td>
Return a count of the number of rows returned
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_count-distinct">
<code class="literal">
COUNT(DISTINCT)
</code>
</a>
</td>
<td>
Return the count of a number of different values
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_group-concat">
<code class="literal">
GROUP_CONCAT()
</code>
</a>
</td>
<td>
Return a concatenated string
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_json-arrayagg">
<code class="literal">
JSON_ARRAYAGG()
</code>
</a>
</td>
<td>
Return result set as a single JSON array
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_json-objectagg">
<code class="literal">
JSON_OBJECTAGG()
</code>
</a>
</td>
<td>
Return result set as a single JSON object
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
</td>
<td>
Return the maximum value
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
</td>
<td>
Return the minimum value
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD()
</code>
</a>
</td>
<td>
Return the population standard deviation
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV()
</code>
</a>
</td>
<td>
Return the population standard deviation
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
</td>
<td>
Return the population standard deviation
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_stddev-samp">
<code class="literal">
STDDEV_SAMP()
</code>
</a>
</td>
<td>
Return the sample standard deviation
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
</td>
<td>
Return the sum
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
</td>
<td>
Return the population standard variance
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP()
</code>
</a>
</td>
<td>
Return the sample variance
</td>
</tr>
<tr>
<td>
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE()
</code>
</a>
</td>
<td>
Return the population standard variance
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 490px;">
<thead>
<tr>
<th style="width: 138.391px;">
Name
</th>
<th style="width: 350.938px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Unless otherwise stated, aggregate functions ignore
<code class="literal">
NULL
</code>
values.
</p>
<p>
If you use an aggregate function in a statement containing no
<code class="literal">
GROUP BY
</code>
clause, it is equivalent to grouping
on all rows. For more information, see
<a class="xref" href="group-by-handling.html" title="14.19.3 MySQL Handling of GROUP BY">
Section 14.19.3, “MySQL Handling of GROUP BY”
</a>
.
</p>
<p>
Most aggregate functions can be used as window functions. Those
that can be used this way are signified in their syntax
description by
<code class="literal">
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
,
representing an optional
<code class="literal">
OVER
</code>
clause.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
, which also includes
other information about window function usage.
</p>
<p>
For numeric arguments, the variance and standard deviation
functions return a
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
value.
The
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
and
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
functions return a
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
value for exact-value
arguments (integer or
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
),
and a
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
value for
approximate-value arguments
(
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
FLOAT
</code>
</a>
or
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
).
</p>
<p>
The
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
and
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
aggregate functions do not
work with temporal values. (They convert the values to numbers,
losing everything after the first nonnumeric character.) To work
around this problem, convert to numeric units, perform the
aggregate operation, and convert back to a temporal value.
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1035995"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">SEC_TO_TIME</span><span class="token punctuation">(</span><span class="token function">SUM</span><span class="token punctuation">(</span><span class="token function">TIME_TO_SEC</span><span class="token punctuation">(</span><em class="replaceable">time_col</em><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">FROM_DAYS</span><span class="token punctuation">(</span><span class="token function">SUM</span><span class="token punctuation">(</span><span class="token function">TO_DAYS</span><span class="token punctuation">(</span><em class="replaceable">date_col</em><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
Functions such as
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
that expect a numeric
argument cast the argument to a number if necessary. For
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
or
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
values, the cast operation
causes the underlying numeric value to be used.
</p>
<p>
The
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
, and
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
aggregate functions
perform bit operations.
</p>
<p>
MySQL bit functions and operators permit binary string type
arguments (
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, and the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
types) and return a value of
like type, which enables them to take arguments and produce
return values larger than 64 bits. For discussion about argument
evaluation and result types for bit operations, see the
introductory discussion in
<a class="xref" href="bit-functions.html" title="14.12 Bit Functions and Operators">
Section 14.12, “Bit Functions and Operators”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_avg">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG([DISTINCT]
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193279872">
</a>
<a class="indexterm" name="idm46045193278800">
</a>
<a class="indexterm" name="idm46045193277728">
</a>
<p>
Returns the average value of
<code class="literal">
<em class="replaceable">
<code>
expr
</code>
</em>
</code>
. The
<code class="literal">
DISTINCT
</code>
option can be used to return the
average of the distinct values of
<em class="replaceable">
<code>
expr
</code>
</em>
.
</p>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
returns
<code class="literal">
NULL
</code>
. The function also returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
; it cannot be used
with
<code class="literal">
DISTINCT
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86728563"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student_name<span class="token punctuation">,</span> <span class="token function">AVG</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_bit-and">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193256128">
</a>
<p>
Returns the bitwise
<code class="literal">
AND
</code>
of all bits in
<em class="replaceable">
<code>
expr
</code>
</em>
.
</p>
<p>
The result type depends on whether the function argument
values are evaluated as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the argument values
have a binary string type, and the argument is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation
occurs otherwise, with argument value conversion to
unsigned 64-bit integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the argument values. If argument values
have unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. If the argument size exceeds 511 bytes, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_aggregate_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
returns a neutral
value (all bits set to 1) having the same length as the
argument values.
</p>
<p>
<code class="literal">
NULL
</code>
values do not affect the result
unless all values are
<code class="literal">
NULL
</code>
. In that case,
the result is a neutral value having the same length as the
argument values.
</p>
<p>
For more information discussion about argument evaluation
and result types, see the introductory discussion in
<a class="xref" href="bit-functions.html" title="14.12 Bit Functions and Operators">
Section 14.12, “Bit Functions and Operators”
</a>
.
</p>
<p>
If
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string
results display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_bit-or">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193228320">
</a>
<p>
Returns the bitwise
<code class="literal">
OR
</code>
of all bits in
<em class="replaceable">
<code>
expr
</code>
</em>
.
</p>
<p>
The result type depends on whether the function argument
values are evaluated as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the argument values
have a binary string type, and the argument is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation
occurs otherwise, with argument value conversion to
unsigned 64-bit integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the argument values. If argument values
have unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. If the argument size exceeds 511 bytes, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_aggregate_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
returns a neutral
value (all bits set to 0) having the same length as the
argument values.
</p>
<p>
<code class="literal">
NULL
</code>
values do not affect the result
unless all values are
<code class="literal">
NULL
</code>
. In that case,
the result is a neutral value having the same length as the
argument values.
</p>
<p>
For more information discussion about argument evaluation
and result types, see the introductory discussion in
<a class="xref" href="bit-functions.html" title="14.12 Bit Functions and Operators">
Section 14.12, “Bit Functions and Operators”
</a>
.
</p>
<p>
If
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string
results display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_bit-xor">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193200512">
</a>
<p>
Returns the bitwise
<a class="link" href="logical-operators.html#operator_xor">
<code class="literal">
XOR
</code>
</a>
of all
bits in
<em class="replaceable">
<code>
expr
</code>
</em>
.
</p>
<p>
The result type depends on whether the function argument
values are evaluated as binary strings or numbers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Binary-string evaluation occurs when the argument values
have a binary string type, and the argument is not a
hexadecimal literal, bit literal, or
<code class="literal">
NULL
</code>
literal. Numeric evaluation
occurs otherwise, with argument value conversion to
unsigned 64-bit integers as necessary.
</p>
</li>
<li class="listitem">
<p>
Binary-string evaluation produces a binary string of the
same length as the argument values. If argument values
have unequal lengths, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_OPERANDS_SIZE
</code>
</a>
error occurs. If the argument size exceeds 511 bytes, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_bitwise_aggregate_operands_size" target="_top">
<code class="literal">
ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE
</code>
</a>
error occurs. Numeric evaluation produces an unsigned
64-bit integer.
</p>
</li>
</ul>
</div>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
returns a neutral
value (all bits set to 0) having the same length as the
argument values.
</p>
<p>
<code class="literal">
NULL
</code>
values do not affect the result
unless all values are
<code class="literal">
NULL
</code>
. In that case,
the result is a neutral value having the same length as the
argument values.
</p>
<p>
For more information discussion about argument evaluation
and result types, see the introductory discussion in
<a class="xref" href="bit-functions.html" title="14.12 Bit Functions and Operators">
Section 14.12, “Bit Functions and Operators”
</a>
.
</p>
<p>
If
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
is invoked from
within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary string
results display using hexadecimal notation, depending on the
value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
.
For more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_count">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193172192">
</a>
<p>
Returns a count of the number of non-
<code class="literal">
NULL
</code>
values of
<em class="replaceable">
<code>
expr
</code>
</em>
in the rows
retrieved by a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement. The result is a
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
value.
</p>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
returns
<code class="literal">
0
</code>
.
<code class="literal">
COUNT(NULL)
</code>
returns
0.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44365415"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student<span class="token punctuation">.</span>student_name<span class="token punctuation">,</span><span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student<span class="token punctuation">,</span>course
<span class="token keyword">WHERE</span> student<span class="token punctuation">.</span>student_id<span class="token operator">=</span>course<span class="token punctuation">.</span>student_id
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(*)
</code>
</a>
is somewhat
different in that it returns a count of the number of rows
retrieved, whether or not they contain
<code class="literal">
NULL
</code>
values.
</p>
<p>
For transactional storage engines such as
<code class="literal">
InnoDB
</code>
, storing an exact row count is
problematic. Multiple transactions may be occurring at the
same time, each of which may affect the count.
</p>
<p>
<code class="literal">
InnoDB
</code>
does not keep an internal count of
rows in a table because concurrent transactions might
<span class="quote">
“
<span class="quote">
see
</span>
”
</span>
different numbers of rows at the same
time. Consequently,
<code class="literal">
SELECT COUNT(*)
</code>
statements only count rows visible to the current
transaction.
</p>
<p>
<code class="literal">
SELECT COUNT(*) FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
query
performance for
<code class="literal">
InnoDB
</code>
tables is
optimized for single-threaded workloads if there are no
extra clauses such as
<code class="literal">
WHERE
</code>
or
<code class="literal">
GROUP BY
</code>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
processes
<code class="literal">
SELECT
COUNT(*)
</code>
statements by traversing the smallest
available secondary index unless an index or optimizer hint
directs the optimizer to use a different index. If a
secondary index is not present,
<code class="literal">
InnoDB
</code>
processes
<code class="literal">
SELECT COUNT(*)
</code>
statements by
scanning the clustered index.
</p>
<p>
Processing of
<code class="literal">
SELECT COUNT(*)
</code>
statements
takes some time if index records are not entirely in the
buffer pool. For a faster count, create a counter table and
let your application update it according to the inserts and
deletes it does. However, this method may not scale well in
situations where thousands of concurrent transactions are
initiating updates to the same counter table. If an
approximate row count is sufficient, use
<a class="link" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
<code class="literal">
SHOW TABLE STATUS
</code>
</a>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
handles
<code class="literal">
SELECT
COUNT(*)
</code>
and
<code class="literal">
SELECT COUNT(1)
</code>
operations in the same way. There is no performance
difference.
</p>
<p>
For
<code class="literal">
MyISAM
</code>
tables,
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(*)
</code>
</a>
is optimized to
return very quickly if the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
retrieves from one
table, no other columns are retrieved, and there is no
<code class="literal">
WHERE
</code>
clause. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa79757004"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> student<span class="token punctuation">;</span></code></pre>
</div>
<p>
This optimization only applies to
<code class="literal">
MyISAM
</code>
tables, because an exact row count is stored for this
storage engine and can be accessed very quickly.
<code class="literal">
COUNT(1)
</code>
is only subject to the same
optimization if the first column is defined as
<code class="literal">
NOT
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_count-distinct">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(DISTINCT
<em class="replaceable">
<code>
expr
</code>
</em>
,[
<em class="replaceable">
<code>
expr
</code>
</em>
...])
</code>
</a>
</p>
<a class="indexterm" name="idm46045193121376">
</a>
<a class="indexterm" name="idm46045193120304">
</a>
<p>
Returns a count of the number of rows with different
non-
<code class="literal">
NULL
</code>
<em class="replaceable">
<code>
expr
</code>
</em>
values.
</p>
<p>
If there are no matching rows,
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(DISTINCT)
</code>
</a>
returns
<code class="literal">
0
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa84077697"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token keyword">DISTINCT</span> results<span class="token punctuation">)</span> <span class="token keyword">FROM</span> student<span class="token punctuation">;</span></code></pre>
</div>
<p>
In MySQL, you can obtain the number of distinct expression
combinations that do not contain
<code class="literal">
NULL
</code>
by
giving a list of expressions. In standard SQL, you would
have to do a concatenation of all expressions inside
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT(DISTINCT ...)
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_group-concat">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_group-concat">
<code class="literal">
GROUP_CONCAT(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045193103552">
</a>
<p>
This function returns a string result with the concatenated
non-
<code class="literal">
NULL
</code>
values from a group. It returns
<code class="literal">
NULL
</code>
if there are no
non-
<code class="literal">
NULL
</code>
values. The full syntax is as
follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43477493"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token function">GROUP_CONCAT</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token keyword">DISTINCT</span><span class="token punctuation">]</span> <em class="replaceable">expr</em> <span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">expr</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> {<em class="replaceable">unsigned_integer</em> <span class="token operator">|</span> <em class="replaceable">col_name</em> <span class="token operator">|</span> <em class="replaceable">expr</em>}
<span class="token punctuation">[</span><span class="token keyword">ASC</span> <span class="token operator">|</span> <span class="token keyword">DESC</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">col_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">SEPARATOR</span> <em class="replaceable">str_val</em><span class="token punctuation">]</span><span class="token punctuation">)</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51754168"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student_name<span class="token punctuation">,</span>
<span class="token function">GROUP_CONCAT</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
<p>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9067881"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student_name<span class="token punctuation">,</span>
<span class="token function">GROUP_CONCAT</span><span class="token punctuation">(</span><span class="token keyword">DISTINCT</span> test_score
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> test_score <span class="token keyword">DESC</span> <span class="token keyword">SEPARATOR</span> <span class="token string">' '</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
<p>
In MySQL, you can get the concatenated values of expression
combinations. To eliminate duplicate values, use the
<code class="literal">
DISTINCT
</code>
clause. To sort values in the
result, use the
<code class="literal">
ORDER BY
</code>
clause. To sort
in reverse order, add the
<code class="literal">
DESC
</code>
(descending) keyword to the name of the column you are
sorting by in the
<code class="literal">
ORDER BY
</code>
clause. The
default is ascending order; this may be specified explicitly
using the
<code class="literal">
ASC
</code>
keyword. The default
separator between values in a group is comma
(
<code class="literal">
,
</code>
). To specify a separator explicitly,
use
<code class="literal">
SEPARATOR
</code>
followed by the string
literal value that should be inserted between group values.
To eliminate the separator altogether, specify
<code class="literal">
SEPARATOR ''
</code>
.
</p>
<p>
The result is truncated to the maximum length that is given
by the
<a class="link" href="server-system-variables.html#sysvar_group_concat_max_len">
<code class="literal">
group_concat_max_len
</code>
</a>
system variable, which has a default value of 1024. The
value can be set higher, although the effective maximum
length of the return value is constrained by the value of
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
. The
syntax to change the value of
<a class="link" href="server-system-variables.html#sysvar_group_concat_max_len">
<code class="literal">
group_concat_max_len
</code>
</a>
at
runtime is as follows, where
<em class="replaceable">
<code>
val
</code>
</em>
is an unsigned integer:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29151605"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token punctuation">[</span><span class="token keyword">GLOBAL</span> <span class="token operator">|</span> <span class="token keyword">SESSION</span><span class="token punctuation">]</span> group_concat_max_len <span class="token operator">=</span> <em class="replaceable">val</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
The return value is a nonbinary or binary string, depending
on whether the arguments are nonbinary or binary strings.
The result type is
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
unless
<a class="link" href="server-system-variables.html#sysvar_group_concat_max_len">
<code class="literal">
group_concat_max_len
</code>
</a>
is
less than or equal to 512, in which case the result type is
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
or
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
.
</p>
<p>
If
<a class="link" href="aggregate-functions.html#function_group-concat">
<code class="literal">
GROUP_CONCAT()
</code>
</a>
is invoked
from within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary
string results display using hexadecimal notation, depending
on the value of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
<p>
See also
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
and
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS()
</code>
</a>
:
<a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
Section 14.8, “String Functions and Operators”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_json-arrayagg">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_json-arrayagg">
<code class="literal">
JSON_ARRAYAGG(
<em class="replaceable">
<code>
col_or_expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193051600">
</a>
<p>
Aggregates a result set as a single
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
array whose elements
consist of the rows. The order of elements in this array is
undefined. The function acts on a column or an expression
that evaluates to a single value. Returns
<code class="literal">
NULL
</code>
if the result contains no rows, or
in the event of an error. If
<em class="replaceable">
<code>
col_or_expr
</code>
</em>
is
<code class="literal">
NULL
</code>
, the function returns an array of
JSON
<code class="literal">
[null]
</code>
elements.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26967611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> o_id<span class="token punctuation">,</span> <span class="token keyword">attribute</span><span class="token punctuation">,</span> <span class="token keyword">value</span> <span class="token keyword">FROM</span> t3<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> o_id <span class="token punctuation">|</span> attribute <span class="token punctuation">|</span> value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> color <span class="token punctuation">|</span> red <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> fabric <span class="token punctuation">|</span> silk <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> color <span class="token punctuation">|</span> green <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> shape <span class="token punctuation">|</span> square<span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">4 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> o_id<span class="token punctuation">,</span> <span class="token function">JSON_ARRAYAGG</span><span class="token punctuation">(</span><span class="token keyword">attribute</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> attributes
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> t3 <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> o_id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> o_id <span class="token punctuation">|</span> attributes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> ["color", "fabric"] <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> ["color", "shape"] <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_json-objectagg">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_json-objectagg">
<code class="literal">
JSON_OBJECTAGG(
<em class="replaceable">
<code>
key
</code>
</em>
,
<em class="replaceable">
<code>
value
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045193031632">
</a>
<p>
Takes two column names or expressions as arguments, the
first of these being used as a key and the second as a
value, and returns a JSON object containing key-value pairs.
Returns
<code class="literal">
NULL
</code>
if the result contains no
rows, or in the event of an error. An error occurs if any
key name is
<code class="literal">
NULL
</code>
or the number of
arguments is not equal to 2.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72317180"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> o_id<span class="token punctuation">,</span> <span class="token keyword">attribute</span><span class="token punctuation">,</span> <span class="token keyword">value</span> <span class="token keyword">FROM</span> t3<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> o_id <span class="token punctuation">|</span> attribute <span class="token punctuation">|</span> value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> color <span class="token punctuation">|</span> red <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> fabric <span class="token punctuation">|</span> silk <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> color <span class="token punctuation">|</span> green <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> shape <span class="token punctuation">|</span> square<span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">4 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> o_id<span class="token punctuation">,</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span><span class="token keyword">attribute</span><span class="token punctuation">,</span> <span class="token keyword">value</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> t3 <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> o_id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> o_id <span class="token punctuation">|</span> JSON_OBJECTAGG(attribute, value) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> {"color": "red", "fabric": "silk"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> {"color": "green", "shape": "square"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
<b>
Duplicate key handling.
</b>
When the result of this function is normalized, values
having duplicate keys are discarded. In keeping with the
MySQL
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
data type
specification that does not permit duplicate keys, only
the last value encountered is used with that key in the
returned object (
<span class="quote">
“
<span class="quote">
last duplicate key wins
</span>
”
</span>
).
This means that the result of using this function on
columns from a
<code class="literal">
SELECT
</code>
can depend on the
order in which the rows are returned, which is not
guaranteed.
</p>
<p>
When used as a window function, if there are duplicate keys
within a frame, only the last value for the key is present
in the result. The value for the key from the last row in
the frame is deterministic if the
<code class="literal">
ORDER
BY
</code>
specification guarantees that the values have a
specific order. If not, the resulting value of the key is
nondeterministic.
</p>
<p>
Consider the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86411192"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t<span class="token punctuation">(</span>c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> i <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.33 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.10 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c<span class="token punctuation">,</span> i <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c <span class="token punctuation">|</span> i <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">3 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_OBJECTAGG(c, i) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.08 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'key'</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.06 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c<span class="token punctuation">,</span> i <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c <span class="token punctuation">|</span> i <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> key <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">3 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_OBJECTAGG(c, i) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The key chosen from the last query is nondeterministic. If
the query does not use
<code class="literal">
GROUP BY
</code>
(which
usually imposes its own ordering regardless) and you prefer
a particular key ordering, you can invoke
<code class="literal">
JSON_OBJECTAGG()
</code>
as a window function by
including an
<code class="literal">
OVER
</code>
clause with an
<code class="literal">
ORDER BY
</code>
specification to impose a
particular order on frame rows. The following examples show
what happens with and without
<code class="literal">
ORDER BY
</code>
for a few different frame specifications.
</p>
<p>
Without
<code class="literal">
ORDER BY
</code>
, the frame is the entire
partition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60342813"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> json_object <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
With
<code class="literal">
ORDER BY
</code>
, where the frame is the
default of
<code class="literal">
RANGE BETWEEN UNBOUNDED PRECEDING AND
CURRENT ROW
</code>
(in both ascending and descending
order):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29719008"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> i<span class="token punctuation">)</span> <span class="token keyword">AS</span> json_object <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 3} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> i <span class="token keyword">DESC</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> json_object <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 4} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 3} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
With
<code class="literal">
ORDER BY
</code>
and an explicit frame of
the entire partition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46423479"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> i
<span class="token keyword">ROWS</span> <span class="token operator">BETWEEN</span> <span class="token keyword">UNBOUNDED</span> <span class="token keyword">PRECEDING</span> <span class="token operator">AND</span> <span class="token keyword">UNBOUNDED</span> <span class="token keyword">FOLLOWING</span><span class="token punctuation">)</span>
<span class="token keyword">AS</span> json_object
<span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To return a particular key value (such as the smallest or
largest), include a
<code class="literal">
LIMIT
</code>
clause in the
appropriate query. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4906526"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> i<span class="token punctuation">)</span> <span class="token keyword">AS</span> json_object <span class="token keyword">FROM</span> t <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 3} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_OBJECTAGG</span><span class="token punctuation">(</span>c<span class="token punctuation">,</span> i<span class="token punctuation">)</span>
<span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> i <span class="token keyword">DESC</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> json_object <span class="token keyword">FROM</span> t <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> json_object <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"key": 5} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
See
<a class="xref" href="json.html#json-normalization" title="Normalization, Merging, and Autowrapping of JSON Values">
Normalization, Merging, and Autowrapping of JSON Values
</a>
, for additional
information and examples.
</p>
</li>
<li class="listitem">
<a name="function_max">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX([DISTINCT]
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192973552">
</a>
<a class="indexterm" name="idm46045192972480">
</a>
<a class="indexterm" name="idm46045192971408">
</a>
<p>
Returns the maximum value of
<em class="replaceable">
<code>
expr
</code>
</em>
.
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
may take a string
argument; in such cases, it returns the maximum string
value. See
<a class="xref" href="mysql-indexes.html" title="10.3.1 How MySQL Uses Indexes">
Section 10.3.1, “How MySQL Uses Indexes”
</a>
. The
<code class="literal">
DISTINCT
</code>
keyword can be used to find the
maximum of the distinct values of
<em class="replaceable">
<code>
expr
</code>
</em>
, however, this produces the
same result as omitting
<code class="literal">
DISTINCT
</code>
.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
; it cannot be used
with
<code class="literal">
DISTINCT
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60546397"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student_name<span class="token punctuation">,</span> <span class="token function">MIN</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
<p>
For
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
, MySQL currently
compares
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
and
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
columns by their string
value rather than by the string's relative position in the
set. This differs from how
<code class="literal">
ORDER BY
</code>
compares them.
</p>
</li>
<li class="listitem">
<a name="function_min">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN([DISTINCT]
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192943280">
</a>
<a class="indexterm" name="idm46045192942208">
</a>
<a class="indexterm" name="idm46045192941136">
</a>
<p>
Returns the minimum value of
<em class="replaceable">
<code>
expr
</code>
</em>
.
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
may take a string
argument; in such cases, it returns the minimum string
value. See
<a class="xref" href="mysql-indexes.html" title="10.3.1 How MySQL Uses Indexes">
Section 10.3.1, “How MySQL Uses Indexes”
</a>
. The
<code class="literal">
DISTINCT
</code>
keyword can be used to find the
minimum of the distinct values of
<em class="replaceable">
<code>
expr
</code>
</em>
, however, this produces the
same result as omitting
<code class="literal">
DISTINCT
</code>
.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
; it cannot be used
with
<code class="literal">
DISTINCT
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60326184"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> student_name<span class="token punctuation">,</span> <span class="token function">MIN</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>test_score<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> student
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> student_name<span class="token punctuation">;</span></code></pre>
</div>
<p>
For
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
, MySQL currently
compares
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
and
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
columns by their string
value rather than by the string's relative position in the
set. This differs from how
<code class="literal">
ORDER BY
</code>
compares them.
</p>
</li>
<li class="listitem">
<a name="function_std">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192913088">
</a>
<p>
Returns the population standard deviation of
<em class="replaceable">
<code>
expr
</code>
</em>
.
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD()
</code>
</a>
is a synonym for the
standard SQL function
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
, provided as a
MySQL extension.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_stddev">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192896016">
</a>
<a class="indexterm" name="idm46045192894944">
</a>
<a class="indexterm" name="idm46045192893872">
</a>
<p>
Returns the population standard deviation of
<em class="replaceable">
<code>
expr
</code>
</em>
.
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV()
</code>
</a>
is a synonym for the
standard SQL function
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
, provided for
compatibility with Oracle.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_stddev-pop">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192876368">
</a>
<p>
Returns the population standard deviation of
<em class="replaceable">
<code>
expr
</code>
</em>
(the square root of
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
). You can also use
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV()
</code>
</a>
, which are
equivalent but not standard SQL.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_stddev-samp">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_stddev-samp">
<code class="literal">
STDDEV_SAMP(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192858064">
</a>
<p>
Returns the sample standard deviation of
<em class="replaceable">
<code>
expr
</code>
</em>
(the square root of
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP()
</code>
</a>
.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_stddev-samp">
<code class="literal">
STDDEV_SAMP()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_sum">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM([DISTINCT]
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192841600">
</a>
<a class="indexterm" name="idm46045192840528">
</a>
<a class="indexterm" name="idm46045192839456">
</a>
<p>
Returns the sum of
<em class="replaceable">
<code>
expr
</code>
</em>
. If the
return set has no rows,
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
returns
<code class="literal">
NULL
</code>
. The
<code class="literal">
DISTINCT
</code>
keyword can be used to sum only
the distinct values of
<em class="replaceable">
<code>
expr
</code>
</em>
.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
; it cannot be used
with
<code class="literal">
DISTINCT
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_var-pop">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192820608">
</a>
<p>
Returns the population standard variance of
<em class="replaceable">
<code>
expr
</code>
</em>
. It considers rows as the
whole population, not as a sample, so it has the number of
rows as the denominator. You can also use
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE()
</code>
</a>
, which is
equivalent but is not standard SQL.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_var-samp">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192804656">
</a>
<p>
Returns the sample variance of
<em class="replaceable">
<code>
expr
</code>
</em>
. That is, the denominator is
the number of rows minus one.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_variance">
</a>
<p>
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE(
<em class="replaceable">
<code>
expr
</code>
</em>
)
[
<em class="replaceable">
<code>
over_clause
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045192790128">
</a>
<p>
Returns the population standard variance of
<em class="replaceable">
<code>
expr
</code>
</em>
.
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE()
</code>
</a>
is a synonym for
the standard SQL function
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
, provided as a
MySQL extension.
</p>
<p>
If there are no matching rows, or if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE()
</code>
</a>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
This function executes as a window function if
<em class="replaceable">
<code>
over_clause
</code>
</em>
is present.
<em class="replaceable">
<code>
over_clause
</code>
</em>
is as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-schema-object-overview.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-schema-object-overview">
</a>
30.4.3.26 The schema_object_overview View
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062521680">
</a>
<a class="indexterm" name="idm46045062520176">
</a>
<p>
This view summarizes the types of objects within each schema.
By default, rows are sorted by schema and object type.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For MySQL instances with a large number of objects, this
view might take a long time to execute.
</p>
</div>
<p>
The
<a class="link" href="sys-schema-object-overview.html" title="30.4.3.26 The schema_object_overview View">
<code class="literal">
schema_object_overview
</code>
</a>
view
has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
db
</code>
</p>
<p>
The schema name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
object_type
</code>
</p>
<p>
The object type:
<code class="literal">
BASE TABLE
</code>
,
<code class="literal">
INDEX
(
<em class="replaceable">
<code>
index_type
</code>
</em>
)
</code>
,
<code class="literal">
EVENT
</code>
,
<code class="literal">
FUNCTION
</code>
,
<code class="literal">
PROCEDURE
</code>
,
<code class="literal">
TRIGGER
</code>
,
<code class="literal">
VIEW
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
count
</code>
</p>
<p>
The number of objects in the schema of the given type.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|