url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/statement-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="statement-optimization">
</a>
10.2 Optimizing SQL Statements
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045230371248">
</a>
<p>
The core logic of a database application is performed through SQL
statements, whether issued directly through an interpreter or
submitted behind the scenes through an API. The tuning guidelines
in this section help to speed up all kinds of MySQL applications.
The guidelines cover SQL operations that read and write data, the
behind-the-scenes overhead for SQL operations in general, and
operations used in specific scenarios such as database monitoring.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/access-control.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="access-control">
</a>
8.2 Access Control and Account Management
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="user-names.html">
8.2.1 Account User Names and Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privileges-provided.html">
8.2.2 Privileges Provided by MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="grant-tables.html">
8.2.3 Grant Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-names.html">
8.2.4 Specifying Account Names
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="role-names.html">
8.2.5 Specifying Role Names
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-access.html">
8.2.6 Access Control, Stage 1: Connection Verification
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="request-access.html">
8.2.7 Access Control, Stage 2: Request Verification
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-accounts.html">
8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reserved-accounts.html">
8.2.9 Reserved Accounts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="roles.html">
8.2.10 Using Roles
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-categories.html">
8.2.11 Account Categories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partial-revokes.html">
8.2.12 Privilege Restriction Using Partial Revokes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privilege-changes.html">
8.2.13 When Privilege Changes Take Effect
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="assigning-passwords.html">
8.2.14 Assigning Account Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="password-management.html">
8.2.15 Password Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="expired-password-handling.html">
8.2.16 Server Handling of Expired Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="pluggable-authentication.html">
8.2.17 Pluggable Authentication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multifactor-authentication.html">
8.2.18 Multifactor Authentication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="proxy-users.html">
8.2.19 Proxy Users
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-locking.html">
8.2.20 Account Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="user-resources.html">
8.2.21 Setting Account Resource Limits
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="problems-connecting.html">
8.2.22 Troubleshooting Problems Connecting to MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-activity-auditing.html">
8.2.23 SQL-Based Account Activity Auditing
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045252340944">
</a>
<a class="indexterm" name="idm46045252339904">
</a>
<a class="indexterm" name="idm46045252338832">
</a>
<a class="indexterm" name="idm46045252337760">
</a>
<a class="indexterm" name="idm46045252336688">
</a>
<a class="indexterm" name="idm46045252335616">
</a>
<a class="indexterm" name="idm46045252334128">
</a>
<a class="indexterm" name="idm46045252333056">
</a>
<a class="indexterm" name="idm46045252331984">
</a>
<a class="indexterm" name="idm46045252330496">
</a>
<p>
MySQL enables the creation of accounts that permit client users to
connect to the server and access data managed by the server. The
primary function of the MySQL privilege system is to authenticate a
user who connects from a given host and to associate that user with
privileges on a database such as
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
,
<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>
. Additional functionality
includes the ability to grant privileges for administrative
operations.
</p>
<p>
To control which users can connect, each account can be assigned
authentication credentials such as a password. The user interface to
MySQL accounts consists of SQL 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>
. See
<a class="xref" href="account-management-statements.html" title="15.7.1 Account Management Statements">
Section 15.7.1, “Account Management Statements”
</a>
.
</p>
<p>
The MySQL privilege system ensures that all users may perform only
the operations permitted to them. As a user, when you connect to a
MySQL server, your identity is determined by
<span class="emphasis">
<em>
the host from
which you connect
</em>
</span>
and
<span class="emphasis">
<em>
the user name you
specify
</em>
</span>
. When you issue requests after connecting, the
system grants privileges according to your identity and
<span class="emphasis">
<em>
what you want to do
</em>
</span>
.
</p>
<p>
MySQL considers both your host name and user name in identifying you
because there is no reason to assume that a given user name belongs
to the same person on all hosts. For example, the user
<code class="literal">
joe
</code>
who connects from
<code class="literal">
office.example.com
</code>
need not be the same person as
the user
<code class="literal">
joe
</code>
who connects from
<code class="literal">
home.example.com
</code>
. MySQL handles this by enabling
you to distinguish users on different hosts that happen to have the
same name: You can grant one set of privileges for connections by
<code class="literal">
joe
</code>
from
<code class="literal">
office.example.com
</code>
,
and a different set of privileges for connections by
<code class="literal">
joe
</code>
from
<code class="literal">
home.example.com
</code>
. To
see what privileges a given account has, use the
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
statement. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29375362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'joe'</span>@<span class="token string">'office.example.com'</span><span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'joe'</span>@<span class="token string">'home.example.com'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Internally, the server stores privilege information in the grant
tables of the
<code class="literal">
mysql
</code>
system database. The MySQL
server reads the contents of these tables into memory when it starts
and bases access-control decisions on the in-memory copies of the
grant tables.
</p>
<p>
MySQL access control involves two stages when you run a client
program that connects to the server:
</p>
<p>
<span class="bold">
<strong>
Stage 1:
</strong>
</span>
The server accepts or
rejects the connection based on your identity and whether you can
verify your identity by supplying the correct password.
</p>
<p>
<span class="bold">
<strong>
Stage 2:
</strong>
</span>
Assuming that you can
connect, the server checks each statement you issue to determine
whether you have sufficient privileges to perform it. For example,
if you try to select rows from a table in a database or drop a table
from the database, the server verifies that you have the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the table or the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege for the database.
</p>
<p>
For a more detailed description of what happens during each stage,
see
<a class="xref" href="connection-access.html" title="8.2.6 Access Control, Stage 1: Connection Verification">
Section 8.2.6, “Access Control, Stage 1: Connection Verification”
</a>
, and
<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>
. For help in diagnosing
privilege-related problems, see
<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>
.
</p>
<p>
If your privileges are changed (either by yourself or someone else)
while you are connected, those changes do not necessarily take
effect immediately for the next statement that you issue. For
details about the conditions under which the server reloads the
grant tables, see
<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>
.
</p>
<p>
There are some things that you cannot do with the MySQL privilege
system:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You cannot explicitly specify that a given user should be denied
access. That is, you cannot explicitly match a user and then
refuse the connection.
</p>
</li>
<li class="listitem">
<p>
You cannot specify that a user has privileges to create or drop
tables in a database but not to create or drop the database
itself.
</p>
</li>
<li class="listitem">
<p>
A password applies globally to an account. You cannot associate
a password with a specific object such as a database, table, or
routine.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/program-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="program-variables">
</a>
6.2.2.5 Using Options to Set Program Variables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045323675840">
</a>
<a class="indexterm" name="idm46045323674384">
</a>
<p>
Many MySQL programs have internal variables that can be set at
runtime using the
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement. 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>
, and
<a class="xref" href="using-system-variables.html" title="7.1.9 Using System Variables">
Section 7.1.9, “Using System Variables”
</a>
.
</p>
<p>
Most of these program variables also can be set at server
startup by using the same syntax that applies to specifying
program options. For example,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
has a
<code class="literal">
max_allowed_packet
</code>
variable that controls the
maximum size of its communication buffer. To set the
<code class="literal">
max_allowed_packet
</code>
variable for
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
to a value of 16MB, use either of the
following commands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa94027082"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16777216</span>
mysql <span class="token constant">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16M</span></code></pre>
</div>
<p>
The first command specifies the value in bytes. The second
specifies the value in megabytes. For variables that take a
numeric value, the value can be given with a suffix of
<code class="literal">
K
</code>
,
<code class="literal">
M
</code>
, or
<code class="literal">
G
</code>
to indicate a multiplier of 1024,
1024
<sup>
2
</sup>
or
1024
<sup>
3
</sup>
. (For example, when used to set
<code class="literal">
max_allowed_packet
</code>
, the suffixes indicate
units of kilobytes, megabytes, or gigabytes.) As of MySQL
8.0.14, a suffix can also be
<code class="literal">
T
</code>
,
<code class="literal">
P
</code>
, and
<code class="literal">
E
</code>
to indicate a
multiplier of 1024
<sup>
4
</sup>
,
1024
<sup>
5
</sup>
or
1024
<sup>
6
</sup>
. Suffix letters can be
uppercase or lowercase.
</p>
<p>
In an option file, variable settings are given without the
leading dashes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa37156971"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
<span class="token constant">max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16777216</span></code></pre>
</div>
<p>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa97037320"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
<span class="token constant">max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16M</span></code></pre>
</div>
<p>
If you like, underscores in an option name can be specified as
dashes. The following option groups are equivalent. Both set the
size of the server's key buffer to 512MB:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa87570409"><div class="copy-help left">Press ⌘+C to 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">key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>512M</span>
<span class="token selector">[mysqld]</span>
<span class="token constant">key-buffer-size</span><span class="token attr-value"><span class="token punctuation">=</span>512M</span></code></pre>
</div>
<p>
Suffixes for specifying a value multiplier can be used when
setting a variable at program invocation time, but not to set
the value with
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
at
runtime. On the other hand, with
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
, you
can assign a variable's value using an expression, which is not
true when you set a variable at server startup. For example, the
first of the following lines is legal at program invocation
time, but the second is not:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa2318503"><div class="copy-help left">Press ⌘+C to 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 constant">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16M</span>
<span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token constant">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>16*1024*1024</span></code></pre>
</div>
<p>
Conversely, the second of the following lines is legal at
runtime, but the first is not:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26361104"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> max_allowed_packet<span class="token operator">=</span>16M<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> max_allowed_packet<span class="token operator">=</span><span class="token number">16</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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-replication-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-replication-tables">
</a>
29.12.11 Performance Schema Replication Tables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="performance-schema-binary-log-transaction-compression-stats-table.html">
29.12.11.1 The binary_log_transaction_compression_stats Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-configuration-table.html">
29.12.11.2 The replication_applier_configuration Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-filters-table.html">
29.12.11.3 The replication_applier_filters Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-global-filters-table.html">
29.12.11.4 The replication_applier_global_filters Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-status-table.html">
29.12.11.5 The replication_applier_status Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-status-by-coordinator-table.html">
29.12.11.6 The replication_applier_status_by_coordinator Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-applier-status-by-worker-table.html">
29.12.11.7 The replication_applier_status_by_worker Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-asynchronous-connection-failover-table.html">
29.12.11.8 The replication_asynchronous_connection_failover Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-asynchronous-connection-failover-managed-table.html">
29.12.11.9 The replication_asynchronous_connection_failover_managed Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-group-communication-information-table.html">
29.12.11.10 The replication_group_communication_information Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-connection-configuration-table.html">
29.12.11.11 The replication_connection_configuration Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-group-configuration-version-table.html">
29.12.11.12 The replication_group_configuration_version Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-connection-status-table.html">
29.12.11.13 The replication_connection_status Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-group-member-actions-table.html">
29.12.11.14 The replication_group_member_actions Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-group-member-stats-table.html">
29.12.11.15 The replication_group_member_stats Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-group-members-table.html">
29.12.11.16 The replication_group_members Table
</a>
</span>
</dt>
</dl>
</div>
<p>
The Performance Schema provides tables that expose replication
information. This is similar to the information available from
the
<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, but representation in table
form is more accessible and has usability benefits:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<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>
output is useful for visual
inspection, but not so much for programmatic use. By
contrast, using the Performance Schema tables, information
about replica status can be searched using general
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
queries, including
complex
<code class="literal">
WHERE
</code>
conditions, joins, and so
forth.
</p>
</li>
<li class="listitem">
<p>
Query results can be saved in tables for further analysis,
or assigned to variables and thus used in stored procedures.
</p>
</li>
<li class="listitem">
<p>
The replication tables provide better diagnostic
information. For multithreaded replica operation,
<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>
reports all coordinator and worker
thread errors using the
<code class="literal">
Last_SQL_Errno
</code>
and
<code class="literal">
Last_SQL_Error
</code>
fields, so only the
most recent of those errors is visible and information can
be lost. The replication tables store errors on a per-thread
basis without loss of information.
</p>
</li>
<li class="listitem">
<p>
The last seen transaction is visible in the replication
tables on a per-worker basis. This is information not
available from
<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>
.
</p>
</li>
<li class="listitem">
<p>
Developers familiar with the Performance Schema interface
can extend the replication tables to provide additional
information by adding rows to the tables.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045071758896">
</a>
Replication Table Descriptions
</h4>
<p>
The Performance Schema provides the following
replication-related tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Tables that contain information about the connection of the
replica to the source:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
<code class="literal">
replication_connection_configuration
</code>
</a>
:
Configuration parameters for connecting to the source
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
:
Current status of the connection to the source
</p>
</li>
<li class="listitem">
<p>
<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>
:
Source lists for the asynchronous connection failover
mechanism
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Tables that contain general (not thread-specific)
information about the transaction applier:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-configuration-table.html" title="29.12.11.2 The replication_applier_configuration Table">
<code class="literal">
replication_applier_configuration
</code>
</a>
:
Configuration parameters for the transaction applier on
the replica.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-table.html" title="29.12.11.5 The replication_applier_status Table">
<code class="literal">
replication_applier_status
</code>
</a>
:
Current status of the transaction applier on the
replica.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Tables that contain information about specific threads
responsible for applying transactions received from the
source:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-by-coordinator-table.html" title="29.12.11.6 The replication_applier_status_by_coordinator Table">
<code class="literal">
replication_applier_status_by_coordinator
</code>
</a>
:
Status of the coordinator thread (empty unless the
replica is multithreaded).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
:
Status of the applier thread or worker threads if the
replica is multithreaded.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Tables that contain information about channel based
replication filters:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-filters-table.html" title="29.12.11.3 The replication_applier_filters Table">
<code class="literal">
replication_applier_filters
</code>
</a>
:
Provides information about the replication filters
configured on specific replication channels.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-global-filters-table.html" title="29.12.11.4 The replication_applier_global_filters Table">
<code class="literal">
replication_applier_global_filters
</code>
</a>
:
Provides information about global replication filters,
which apply to all replication channels.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Tables that contain information about Group Replication
members:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<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>
:
Provides network and status information for group
members.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-group-member-stats-table.html" title="29.12.11.15 The replication_group_member_stats Table">
<code class="literal">
replication_group_member_stats
</code>
</a>
:
Provides statistical information about group members and
transactions in which they participate.
</p>
</li>
</ul>
</div>
<p>
For more information see
<a class="xref" href="group-replication-monitoring.html" title="20.4 Monitoring Group Replication">
Section 20.4, “Monitoring Group Replication”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The following Performance Schema replication tables continue to
be populated when the Performance Schema is disabled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
<code class="literal">
replication_connection_configuration
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<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>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-configuration-table.html" title="29.12.11.2 The replication_applier_configuration Table">
<code class="literal">
replication_applier_configuration
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-table.html" title="29.12.11.5 The replication_applier_status Table">
<code class="literal">
replication_applier_status
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-by-coordinator-table.html" title="29.12.11.6 The replication_applier_status_by_coordinator Table">
<code class="literal">
replication_applier_status_by_coordinator
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
The exception is local timing information (start and end
timestamps for transactions) in the replication tables
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
,
<a class="link" href="performance-schema-replication-applier-status-by-coordinator-table.html" title="29.12.11.6 The replication_applier_status_by_coordinator Table">
<code class="literal">
replication_applier_status_by_coordinator
</code>
</a>
,
and
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
.
This information is not collected when the Performance Schema is
disabled.
</p>
<p>
The following sections describe each replication table in more
detail, including the correspondence between the columns
produced by
<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>
and the replication table columns in
which the same information appears.
</p>
<p>
The remainder of this introduction to the replication tables
describes how the Performance Schema populates them and which
fields from
<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>
are not represented in the tables.
</p>
<h4>
<a name="idm46045071701552">
</a>
Replication Table Life Cycle
</h4>
<p>
The Performance Schema populates the replication tables as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Prior to execution of
<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>
, the tables are empty.
</p>
</li>
<li class="listitem">
<p>
After
<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>
, the configuration parameters can be seen in
the tables. At this time, there are no active replication
threads, so the
<code class="literal">
THREAD_ID
</code>
columns are
<code class="literal">
NULL
</code>
and the
<code class="literal">
SERVICE_STATE
</code>
columns have a value of
<code class="literal">
OFF
</code>
.
</p>
</li>
<li class="listitem">
<p>
After
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
, non-null
<code class="literal">
THREAD_ID
</code>
values can be seen. Threads that are idle or active have a
<code class="literal">
SERVICE_STATE
</code>
value of
<code class="literal">
ON
</code>
. The thread that connects to the
source has a value of
<code class="literal">
CONNECTING
</code>
while it
establishes the connection, and
<code class="literal">
ON
</code>
thereafter as long as the connection lasts.
</p>
</li>
<li class="listitem">
<p>
After
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
, the
<code class="literal">
THREAD_ID
</code>
columns
become
<code class="literal">
NULL
</code>
and the
<code class="literal">
SERVICE_STATE
</code>
columns for threads that no
longer exist have a value of
<code class="literal">
OFF
</code>
.
</p>
</li>
<li class="listitem">
<p>
The tables are preserved after
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
or threads stopping due to an error.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
table is nonempty only when the replica is operating in
multithreaded mode. That is, if the
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
system variable is greater than 0, this table is populated
when
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
is executed, and the number of rows shows
the number of workers.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045071674896">
</a>
Replica Status Information Not In the Replication Tables
</h4>
<p>
The information in the Performance Schema replication tables
differs somewhat from the information available from
<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>
because the tables are oriented toward
use of global transaction identifiers (GTIDs), not file names
and positions, and they represent server UUID values, not server
ID values. Due to these differences, several
<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>
columns are not preserved in the
Performance Schema replication tables, or are represented a
different way:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The following fields refer to file names and positions and
are not preserved:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa55666917"><div class="copy-help left">Press ⌘+C to 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">Master_Log_File
Read_Master_Log_Pos
Relay_Log_File
Relay_Log_Pos
Relay_Master_Log_File
Exec_Master_Log_Pos
Until_Condition
Until_Log_File
Until_Log_Pos</code></pre>
</div>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Master_Info_File
</code>
field is not
preserved. It refers to the
<code class="filename">
master.info
</code>
file used for the replica's source metadata repository,
which has been superseded by the use of crash-safe tables
for the repository.
</p>
</li>
<li class="listitem">
<p>
The following fields are based on
<a class="link" href="replication-options.html#sysvar_server_id">
<code class="literal">
server_id
</code>
</a>
, not
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
, and are not
preserved:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa7404917"><div class="copy-help left">Press ⌘+C to 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">Master_Server_Id
Replicate_Ignore_Server_Ids</code></pre>
</div>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Skip_Counter
</code>
field is based on event
counts, not GTIDs, and is not preserved.
</p>
</li>
<li class="listitem">
<p>
These error fields are aliases for
<code class="literal">
Last_SQL_Errno
</code>
and
<code class="literal">
Last_SQL_Error
</code>
, so they are not
preserved:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa37235329"><div class="copy-help left">Press ⌘+C to 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">Last_Errno
Last_Error</code></pre>
</div>
<p>
In the Performance Schema, this error information is
available in the
<code class="literal">
LAST_ERROR_NUMBER
</code>
and
<code class="literal">
LAST_ERROR_MESSAGE
</code>
columns of the
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
table (and
<a class="link" href="performance-schema-replication-applier-status-by-coordinator-table.html" title="29.12.11.6 The replication_applier_status_by_coordinator Table">
<code class="literal">
replication_applier_status_by_coordinator
</code>
</a>
if the replica is multithreaded). Those tables provide more
specific per-thread error information than is available from
<code class="literal">
Last_Errno
</code>
and
<code class="literal">
Last_Error
</code>
.
</p>
</li>
<li class="listitem">
<p>
Fields that provide information about command-line filtering
options is not preserved:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa61238406"><div class="copy-help left">Press ⌘+C to 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">Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table</code></pre>
</div>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Replica_IO_State
</code>
and
<code class="literal">
Replica_SQL_Running_State
</code>
fields are not
preserved. If needed, these values can be obtained from the
process list by using the
<code class="literal">
THREAD_ID
</code>
column of the appropriate replication table and joining it
with the
<code class="literal">
ID
</code>
column in 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 to select the
<code class="literal">
STATE
</code>
column of the latter table.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Executed_Gtid_Set
</code>
field can show a
large set with a great deal of text. Instead, the
Performance Schema tables show GTIDs of transactions that
are currently being applied by the replica. Alternatively,
the set of executed GTIDs can be obtained from the value of
the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Seconds_Behind_Master
</code>
and
<code class="literal">
Relay_Log_Space
</code>
fields are in
to-be-decided status and are not preserved.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045071635792">
</a>
Replication Channels
</h4>
<p>
The first column of the replication Performance Schema tables is
<code class="literal">
CHANNEL_NAME
</code>
. This enables the tables to be
viewed per replication channel. In a non-multisource replication
setup there is a single default replication channel. When you
are using multiple replication channels on a replica, you can
filter the tables per replication channel to monitor a specific
replication channel. See
<a class="xref" href="replication-channels.html" title="19.2.2 Replication Channels">
Section 19.2.2, “Replication Channels”
</a>
and
<a class="xref" href="replication-multi-source-monitoring.html" title="19.1.5.8 Monitoring Multi-Source Replication">
Section 19.1.5.8, “Monitoring Multi-Source Replication”
</a>
for
more information.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-solutions-performance.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-solutions-performance">
</a>
19.4.7 Improving Replication Performance
</h3>
</div>
</div>
</div>
<p>
As the number of replicas connecting to a source increases, the
load, although minimal, also increases, as each replica uses a
client connection to the source. Also, as each replica must
receive a full copy of the source's binary log, the network load
on the source may also increase and create a bottleneck.
</p>
<p>
If you are using a large number of replicas connected to one
source, and that source is also busy processing requests (for
example, as part of a scale-out solution), then you may want to
improve the performance of the replication process.
</p>
<p>
One way to improve the performance of the replication process is
to create a deeper replication structure that enables the source
to replicate to only one replica, and for the remaining replicas
to connect to this primary replica for their individual
replication requirements. A sample of this structure is shown in
<a class="xref" href="replication-solutions-performance.html#figure_replication-performance" title="Figure 19.3 Using an Additional Replication Source to Improve Performance">
Figure 19.3, “Using an Additional Replication Source to Improve Performance”
</a>
.
</p>
<div class="figure">
<a name="figure_replication-performance">
</a>
<p class="title">
<b>
Figure 19.3 Using an Additional Replication Source to Improve Performance
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="The server MySQL Source 1 replicates to the server MySQL Source 2, which in turn replicates to the servers MySQL Replica 1, MySQL Replica 2, and MySQL Replica 3." src="images/subsource-performance.png" style="width: 100%; max-width: 370px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
For this to work, you must configure the MySQL instances as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Source 1 is the primary source where all changes and updates
are written to the database. Binary logging is enabled on both
source servers, which is the default.
</p>
</li>
<li class="listitem">
<p>
Source 2 is the replica to the server Source 1 that provides
the replication functionality to the remainder of the replicas
in the replication structure. Source 2 is the only machine
permitted to connect to Source 1. Source 2 has the
<a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
<code class="option">
--log-replica-updates
</code>
</a>
option
enabled (the default). With this option, replication
instructions from Source 1 are also written to Source 2's
binary log so that they can then be replicated to the true
replicas.
</p>
</li>
<li class="listitem">
<p>
Replica 1, Replica 2, and Replica 3 act as replicas to Source
2, and replicate the information from Source 2, which actually
consists of the upgrades logged on Source 1.
</p>
</li>
</ul>
</div>
<p>
The above solution reduces the client load and the network
interface load on the primary source, which should improve the
overall performance of the primary source when used as a direct
database solution.
</p>
<p>
If your replicas are having trouble keeping up with the
replication process on the source, there are a number of options
available:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If possible, put the relay logs and the data files on
different physical drives. To do this, set the
<a class="link" href="replication-options-replica.html#sysvar_relay_log">
<code class="literal">
relay_log
</code>
</a>
system variable to
specify the location of the relay log.
</p>
</li>
<li class="listitem">
<p>
If heavy disk I/O activity for reads of the binary log file
and relay log files is an issue, consider increasing the value
of the
<a class="link" href="replication-options-replica.html#sysvar_rpl_read_size">
<code class="literal">
rpl_read_size
</code>
</a>
system
variable. This system variable controls the minimum amount of
data read from the log files, and increasing it might reduce
file reads and I/O stalls when the file data is not currently
cached by the operating system. Note that a buffer the size of
this value is allocated for each thread that reads from the
binary log and relay log files, including dump threads on
sources and coordinator threads on replicas. Setting a large
value might therefore have an impact on memory consumption for
servers.
</p>
</li>
<li class="listitem">
<p>
If the replicas are significantly slower than the source, you
may want to divide up the responsibility for replicating
different databases to different replicas. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
If your source makes use of transactions and you are not
concerned about transaction support on your replicas, use
<code class="literal">
MyISAM
</code>
or another nontransactional engine
on the replicas. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
If your replicas are not acting as sources, and you have a
potential solution in place to ensure that you can bring up a
source in the event of failure, then you can disable
<a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
<code class="literal">
log_replica_updates
</code>
</a>
. This
prevents
<span class="quote">
“
<span class="quote">
dumb
</span>
”
</span>
replicas from also logging events
they have executed into their own binary log.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/tutorial.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="tutorial">
</a>
Chapter 5 Tutorial
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="connecting-disconnecting.html">
5.1 Connecting to and Disconnecting from the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="entering-queries.html">
5.2 Entering Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="database-use.html">
5.3 Creating and Using a Database
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="creating-database.html">
5.3.1 Creating and Selecting a Database
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-tables.html">
5.3.2 Creating a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="loading-tables.html">
5.3.3 Loading Data into a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="retrieving-data.html">
5.3.4 Retrieving Information from a Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="getting-information.html">
5.4 Getting Information About Databases and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="batch-mode.html">
5.5 Using mysql in Batch Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="examples.html">
5.6 Examples of Common Queries
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="example-maximum-column.html">
5.6.1 The Maximum Value for a Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-row.html">
5.6.2 The Row Holding the Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group.html">
5.6.3 Maximum of Column per Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group-row.html">
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-user-variables.html">
5.6.5 Using User-Defined Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-foreign-keys.html">
5.6.6 Using Foreign Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="searching-on-two-keys.html">
5.6.7 Searching on Two Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="calculating-days.html">
5.6.8 Calculating Visits Per Day
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-auto-increment.html">
5.6.9 Using AUTO_INCREMENT
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="apache.html">
5.7 Using MySQL with Apache
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045325707536">
</a>
<a class="indexterm" name="idm46045325706464">
</a>
<a class="indexterm" name="idm46045325704976">
</a>
<a class="indexterm" name="idm46045325703488">
</a>
<p>
This chapter provides a tutorial introduction to MySQL by showing
how to use 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 to create and
use a simple database.
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
(sometimes referred
to as the
<span class="quote">
“
<span class="quote">
terminal monitor
</span>
”
</span>
or just
<span class="quote">
“
<span class="quote">
monitor
</span>
”
</span>
) is an interactive program that enables you
to connect to a MySQL server, run queries, and view the results.
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
may also be used in batch mode: you place
your queries in a file beforehand, then tell
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
to execute the contents of the file. Both
ways of using
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
are covered here.
</p>
<p>
To see a list of options provided by
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
,
invoke it with the
<a class="link" href="mysql-command-options.html#option_mysql_help">
<code class="option">
--help
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa10502551"><div class="copy-help left">Press ⌘+C to 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">--help</span></code></pre>
</div>
<p>
This chapter assumes 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>
is installed on
your machine and that a MySQL server is available to which you can
connect. If this is not true, contact your MySQL administrator. (If
<span class="emphasis">
<em>
you
</em>
</span>
are the administrator, you need to consult
the relevant portions of this manual, such as
<a class="xref" href="server-administration.html" title="Chapter 7 MySQL Server Administration">
Chapter 7,
<i>
MySQL Server Administration
</i>
</a>
.)
</p>
<p>
This chapter describes the entire process of setting up and using a
database. If you are interested only in accessing an existing
database, you may want to skip the sections that describe how to
create the database and the tables it contains.
</p>
<p>
Because this chapter is tutorial in nature, many details are
necessarily omitted. Consult the relevant sections of the manual for
more information on the topics covered here.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-schema-usage.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="sys-schema-usage">
</a>
30.2 Using the sys Schema
</h2>
</div>
</div>
</div>
<p>
You can make the
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema the
default schema so that references to its objects need not be
qualified with the schema name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64909930"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> sys<span class="token punctuation">;</span>
<span class="token keyword">Database</span> <span class="token keyword">changed</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> version<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>
<span class="token output"><span class="token punctuation">|</span> sys_version <span class="token punctuation">|</span> mysql_version <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.1.1 <span class="token punctuation">|</span> 8.4.0<span class="token punctuation">-</span>tr <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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
<a class="link" href="sys-version.html" title="30.4.3.47 The version View">
<code class="literal">
version
</code>
</a>
view shows the
<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>
<p>
To access
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema objects while a
different schema is the default (or simply to be explicit),
qualify object references with the schema name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77550502"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sys<span class="token punctuation">.</span>version<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>
<span class="token output"><span class="token punctuation">|</span> sys_version <span class="token punctuation">|</span> mysql_version <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.1.1 <span class="token punctuation">|</span> 8.4.0<span class="token punctuation">-</span>tr <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">
sys
</code>
schema contains many views that
summarize Performance Schema tables in various ways. Most of these
views come in pairs, such that one member of the pair has the same
name as the other member, plus a
<code class="literal">
x$
</code>
prefix. For
example, the
<a class="link" href="sys-host-summary-by-file-io.html" title="30.4.3.2 The host_summary_by_file_io and x$host_summary_by_file_io Views">
<code class="literal">
host_summary_by_file_io
</code>
</a>
view summarizes file I/O grouped by host and displays latencies
converted from picoseconds to more readable values (with units);
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58627164"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sys<span class="token punctuation">.</span>host_summary_by_file_io<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> host <span class="token punctuation">|</span> ios <span class="token punctuation">|</span> io_latency <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> 67570 <span class="token punctuation">|</span> 5.38 s <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> background <span class="token punctuation">|</span> 3468 <span class="token punctuation">|</span> 4.18 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></code></pre>
</div>
<p>
The
<a class="link" href="sys-host-summary-by-file-io.html" title="30.4.3.2 The host_summary_by_file_io and x$host_summary_by_file_io Views">
<code class="literal">
x$host_summary_by_file_io
</code>
</a>
view
summarizes the same data but displays unformatted picosecond
latencies:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48799756"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sys<span class="token punctuation">.</span>x$host_summary_by_file_io<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> host <span class="token punctuation">|</span> ios <span class="token punctuation">|</span> io_latency <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> 67574 <span class="token punctuation">|</span> 5380678125144 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> background <span class="token punctuation">|</span> 3474 <span class="token punctuation">|</span> 4758696829416 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 view without the
<code class="literal">
x$
</code>
prefix is intended to
provide output that is more user friendly and easier for humans to
read. The view with the
<code class="literal">
x$
</code>
prefix that displays
the same values in raw form is intended more for use with other
tools that perform their own processing on the data. For
additional information about the differences between
non-
<code class="literal">
x$
</code>
and
<code class="literal">
x$
</code>
views, see
<a class="xref" href="sys-schema-views.html" title="30.4.3 sys Schema Views">
Section 30.4.3, “sys Schema Views”
</a>
.
</p>
<p>
To examine
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema object
definitions, use the appropriate
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statement or
<a class="link" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
<code class="literal">
INFORMATION_SCHEMA
</code>
</a>
query. For
example, to examine the definitions of the
<a class="link" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
<code class="literal">
session
</code>
</a>
view and
<a class="link" href="sys-format-bytes.html" title="30.4.5.3 The format_bytes() Function">
<code class="literal">
format_bytes()
</code>
</a>
function, use these
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46007629"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">VIEW</span> sys<span class="token punctuation">.</span><span class="token keyword">session</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> sys<span class="token punctuation">.</span>format_bytes<span class="token punctuation">;</span></code></pre>
</div>
<p>
However, those statements display the definitions in relatively
unformatted form. To view object definitions with more readable
formatting, access the individual
<code class="filename">
.sql
</code>
files
found under the
<code class="filename">
scripts/sys_schema
</code>
directory
in MySQL source distributions.
</p>
<p>
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
does not dump the
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema by default. To generate a
dump file, name the
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema
explicitly on the command line using either of these commands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa32999067"><div class="copy-help left">Press ⌘+C to 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">mysqldump <span class="token property">--databases</span> <span class="token property">--routines</span> sys > sys_dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
To reinstall the schema from the dump file, use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa46230416"><div class="copy-help left">Press ⌘+C to 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">mysql < sys_dump<span class="token punctuation">.</span>sql</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/apis-php-info.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="apis-php-info">
</a>
31.8 MySQL PHP API
</h2>
</div>
</div>
</div>
<p>
The MySQL PHP API manual is now published in standalone form, not as
part of the MySQL Reference Manual. See
<a class="ulink" href="/doc/apis-php/en/" target="_top">
MySQL and PHP
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-linux-rpm.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-linux-rpm">
</a>
25.3.1.2 Installing NDB Cluster from RPM
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045122894064">
</a>
<a class="indexterm" name="idm46045122892576">
</a>
<p>
This section covers the steps necessary to install the correct
executables for each type of NDB Cluster node using RPM packages
supplied by Oracle.
</p>
<p>
As an alternative to the method described in this section,
Oracle provides MySQL Repositories for NDB Cluster that are
compatible with many common Linux distributions. Two
repositories, listed here, are available for RPM-based
distributions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For distributions using
<span class="command">
<strong>
yum
</strong>
</span>
or
<span class="command">
<strong>
dnf
</strong>
</span>
, you can use the
MySQL Yum Repository for NDB Cluster. See
<a class="ulink" href="/doc/mysql-yum-repo-quick-guide/en/#repo-qg-yum-fresh-cluster-install" target="_top">
<em class="citetitle">
Installing
MySQL NDB Cluster Using the Yum
Repository
</em>
</a>
, for instructions and
additional information.
</p>
</li>
<li class="listitem">
<p>
For SLES, you can use the MySQL SLES Repository for NDB
Cluster. See
<a class="ulink" href="/doc/mysql-sles-repo-quick-guide/en/#repo-qg-sles-fresh-cluster-install" target="_top">
<em class="citetitle">
Installing
MySQL NDB Cluster Using the SLES
Repository
</em>
</a>
, for instructions and
additional information.
</p>
</li>
</ul>
</div>
<p>
RPMs are available for both 32-bit and 64-bit Linux platforms.
The filenames for these RPMs use the following pattern:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa50125243"><div class="copy-help left">Press ⌘+C to 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>community<span class="token operator">-</span>data<span class="token operator">-</span>node<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>1<span class="token punctuation">.</span>el7<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm
mysql<span class="token operator">-</span>cluster<span class="token operator">-</span><em class="replaceable">license</em><span class="token operator">-</span><em class="replaceable">component</em><span class="token operator">-</span><em class="replaceable">ver</em><span class="token operator">-</span><em class="replaceable">rev</em><span class="token punctuation">.</span><em class="replaceable">distro</em><span class="token punctuation">.</span><em class="replaceable">arch</em><span class="token punctuation">.</span>rpm
<em class="replaceable">license</em><span class="token operator">:</span><span class="token operator">=</span> <span class="token punctuation">{</span>commercial <span class="token operator">|</span> community<span class="token punctuation">}</span>
<em class="replaceable">component</em><span class="token operator">:</span> <span class="token punctuation">{</span>management<span class="token operator">-</span>server <span class="token operator">|</span> data<span class="token operator">-</span>node <span class="token operator">|</span> server <span class="token operator">|</span> client <span class="token operator">|</span> <em class="replaceable">other—see text</em><span class="token punctuation">}</span>
<em class="replaceable">ver</em><span class="token operator">:</span> <em class="replaceable">major</em><span class="token punctuation">.</span><em class="replaceable">minor</em><span class="token punctuation">.</span><em class="replaceable">release</em>
<em class="replaceable">rev</em><span class="token operator">:</span> <em class="replaceable">major</em><span class="token punctuation">[</span><span class="token punctuation">.</span><em class="replaceable">minor</em><span class="token punctuation">]</span>
<em class="replaceable">distro</em><span class="token operator">:</span> <span class="token punctuation">{</span>el6 <span class="token operator">|</span> el7 <span class="token operator">|</span> sles12<span class="token punctuation">}</span>
<em class="replaceable">arch</em><span class="token operator">:</span> <span class="token punctuation">{</span>i686 <span class="token operator">|</span> x86_64<span class="token punctuation">}</span></code></pre>
</div>
<p>
<em class="replaceable">
<code>
license
</code>
</em>
indicates whether the RPM is
part of a Commercial or Community release of NDB Cluster. In the
remainder of this section, we assume for the examples that you
are installing a Community release.
</p>
<p>
Possible values for
<em class="replaceable">
<code>
component
</code>
</em>
, with
descriptions, can be found in the following table:
</p>
<div class="table">
<a name="idm46045122872480">
</a>
<p class="title">
<b>
Table 25.5 Components of the NDB Cluster RPM distribution
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
Component
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
auto-installer
</code>
(DEPRECATED)
</td>
<td>
NDB Cluster Auto Installer program; see
<a class="ulink" href="/doc/refman/8.0/en/mysql-cluster-installer.html" target="_top">
The NDB Cluster Auto-Installer (NO LONGER SUPPORTED)
</a>
, for usage
</td>
</tr>
<tr>
<td>
<code class="literal">
client
</code>
</td>
<td>
MySQL and
<code class="literal">
NDB
</code>
client programs; includes
<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 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, and other client
tools
</td>
</tr>
<tr>
<td>
<code class="literal">
common
</code>
</td>
<td>
Character set and error message information needed by the MySQL server
</td>
</tr>
<tr>
<td>
<code class="literal">
data-node
</code>
</td>
<td>
<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-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
data node binaries
</td>
</tr>
<tr>
<td>
<code class="literal">
devel
</code>
</td>
<td>
Headers and library files needed for MySQL client development
</td>
</tr>
<tr>
<td>
<code class="literal">
embedded
</code>
</td>
<td>
Embedded MySQL server
</td>
</tr>
<tr>
<td>
<code class="literal">
embedded-compat
</code>
</td>
<td>
Backwards-compatible embedded MySQL server
</td>
</tr>
<tr>
<td>
<code class="literal">
embedded-devel
</code>
</td>
<td>
Header and library files for developing applications for embedded MySQL
</td>
</tr>
<tr>
<td>
<code class="literal">
java
</code>
</td>
<td>
JAR files needed for support of ClusterJ applications
</td>
</tr>
<tr>
<td>
<code class="literal">
libs
</code>
</td>
<td>
MySQL client libraries
</td>
</tr>
<tr>
<td>
<code class="literal">
libs-compat
</code>
</td>
<td>
Backwards-compatible MySQL client libraries
</td>
</tr>
<tr>
<td>
<code class="literal">
management-server
</code>
</td>
<td>
The NDB Cluster management server (
<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>
)
</td>
</tr>
<tr>
<td>
<code class="literal">
memcached
</code>
</td>
<td>
Files needed to support
<code class="literal">
ndbmemcache
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
minimal-debuginfo
</code>
</td>
<td>
Debug information for package server-minimal; useful when developing
applications that use this package or when debugging
this package
</td>
</tr>
<tr>
<td>
<code class="literal">
ndbclient
</code>
</td>
<td>
<code class="literal">
NDB
</code>
client library for running NDB API and MGM API
applications (
<code class="literal">
libndbclient
</code>
)
</td>
</tr>
<tr>
<td>
<code class="literal">
ndbclient-devel
</code>
</td>
<td>
Header and other files needed for developing NDB API and MGM API
applications
</td>
</tr>
<tr>
<td>
<code class="literal">
nodejs
</code>
</td>
<td>
Files needed to set up Node.JS support for NDB Cluster
</td>
</tr>
<tr>
<td>
<code class="literal">
server
</code>
</td>
<td>
The MySQL server (
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
) with
<code class="literal">
NDB
</code>
storage engine support included, and associated MySQL
server programs
</td>
</tr>
<tr>
<td>
<code class="literal">
server-minimal
</code>
</td>
<td>
Minimal installation of the MySQL server for NDB and related tools
</td>
</tr>
<tr>
<td>
<code class="literal">
test
</code>
</td>
<td>
<span class="command">
<strong>
mysqltest
</strong>
</span>
, other MySQL test programs, and support
files
</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: 369px;">
Component
</th>
<th style="width: 369px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<p>
<br class="table-break"/>
</p>
<p>
A single bundle (
<code class="filename">
.tar
</code>
file) of all NDB
Cluster RPMs for a given platform and architecture is also
available. The name of this file follows the pattern shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa18556562"><div class="copy-help left">Press ⌘+C to 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><em class="replaceable">license</em><span class="token operator">-</span><em class="replaceable">ver</em><span class="token operator">-</span><em class="replaceable">rev</em><span class="token punctuation">.</span><em class="replaceable">distro</em><span class="token punctuation">.</span><em class="replaceable">arch</em><span class="token punctuation">.</span>rpm<span class="token operator">-</span>bundle<span class="token punctuation">.</span>tar</code></pre>
</div>
<p>
You can extract the individual RPM files from this file using
<span class="command">
<strong>
tar
</strong>
</span>
or your preferred tool for extracting
archives.
</p>
<p>
The components required to install the three major types of NDB
Cluster nodes are given in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Management node
</em>
</span>
:
<code class="literal">
management-server
</code>
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Data node
</em>
</span>
:
<code class="literal">
data-node
</code>
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
SQL node
</em>
</span>
:
<code class="literal">
server
</code>
and
<code class="literal">
common
</code>
</p>
</li>
</ul>
</div>
<p>
In addition, the
<code class="literal">
client
</code>
RPM should be
installed to provide 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 on at least one management node. You may also wish to
install it on SQL nodes, to have
<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
other MySQL client programs available on these. We discuss
installation of nodes by type later in this section.
</p>
<p>
<em class="replaceable">
<code>
ver
</code>
</em>
represents the three-part
<code class="literal">
NDB
</code>
storage engine version number in
8.4.
<em class="replaceable">
<code>
x
</code>
</em>
format, shown as
<code class="literal">
8.4.0
</code>
in the examples.
<code class="literal">
rev
</code>
provides the RPM revision number in
<em class="replaceable">
<code>
major
</code>
</em>
.
<em class="replaceable">
<code>
minor
</code>
</em>
format. In the examples shown in this section, we use
<code class="literal">
1.1
</code>
for this value.
</p>
<p>
The
<em class="replaceable">
<code>
distro
</code>
</em>
(Linux distribution) is
one of
<code class="literal">
rhel5
</code>
(Oracle Linux 5, Red Hat
Enterprise Linux 4 and 5),
<code class="literal">
el6
</code>
(Oracle Linux
6, Red Hat Enterprise Linux 6),
<code class="literal">
el7
</code>
(Oracle
Linux 7, Red Hat Enterprise Linux 7), or
<code class="literal">
sles12
</code>
(SUSE Enterprise Linux 12). For the
examples in this section, we assume that the host runs Oracle
Linux 7, Red Hat Enterprise Linux 7, or the equivalent
(
<code class="literal">
el7
</code>
).
</p>
<p>
<em class="replaceable">
<code>
arch
</code>
</em>
is
<code class="literal">
i686
</code>
for
32-bit RPMs and
<code class="literal">
x86_64
</code>
for 64-bit versions.
In the examples shown here, we assume a 64-bit platform.
</p>
<p>
The NDB Cluster version number in the RPM file names (shown here
as
<code class="literal">
8.4.0
</code>
) can vary
according to the version which you are actually using.
<span class="emphasis">
<em>
It is very important that all of the Cluster RPMs to
be installed have the same version number
</em>
</span>
. The
architecture should also be appropriate to the machine on which
the RPM is to be installed; in particular, you should keep in
mind that 64-bit RPMs (
<code class="literal">
x86_64
</code>
) cannot be used
with 32-bit operating systems (use
<code class="literal">
i686
</code>
for
the latter).
</p>
<p>
<b>
Data nodes.
</b>
On a computer that is to host an NDB Cluster data node it is
necessary to install only the
<code class="literal">
data-node
</code>
RPM. To do so, copy this RPM to the data node host, and run
the following command as the system root user, replacing the
name shown for the RPM as necessary to match that of the RPM
downloaded from the MySQL website:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa43766748"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> mysql-cluster-community-data-node-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>el7<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This installs the
<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-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
data node binaries in
<code class="filename">
/usr/sbin
</code>
. Either of these can be used to
run a data node process on this host.
</p>
<p>
<b>
SQL nodes.
</b>
Copy the
<code class="literal">
server
</code>
and
<code class="literal">
common
</code>
RPMs to each machine to be used for
hosting an NDB Cluster SQL node (
<code class="literal">
server
</code>
requires
<code class="literal">
common
</code>
). Install the
<code class="literal">
server
</code>
RPM by executing the following
command as the system root user, replacing the name shown for
the RPM as necessary to match the name of the RPM downloaded
from the MySQL website:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa40334431"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> mysql-cluster-community-server-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>el7<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This installs the MySQL server binary
(
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
), with
<code class="literal">
NDB
</code>
storage
engine support, in the
<code class="filename">
/usr/sbin
</code>
directory.
It also installs all needed MySQL Server support files and
useful MySQL server programs, including the
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
and
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
startup scripts (in
<code class="filename">
/usr/share/mysql
</code>
and
<code class="filename">
/usr/bin
</code>
, respectively). The RPM installer
should take care of general configuration issues (such as
creating the
<code class="literal">
mysql
</code>
user and group, if needed)
automatically.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You must use the versions of these RPMs released for NDB
Cluster; those released for the standard MySQL server do not
provide support for the
<code class="literal">
NDB
</code>
storage engine.
</p>
</div>
<p>
To administer the SQL node (MySQL server), you should also
install the
<code class="literal">
client
</code>
RPM, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa49160295"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> mysql-cluster-community-client-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>el7<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This installs 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 and other
MySQL client programs, such as
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
and
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
, to
<code class="filename">
/usr/bin
</code>
.
</p>
<p>
<b>
Management nodes.
</b>
To install the NDB Cluster management server, it is necessary
only to use the
<code class="literal">
management-server
</code>
RPM. Copy
this RPM to the computer intended to host the management node,
and then install it by running the following command as the
system root user (replace the name shown for the RPM as
necessary to match that of the
<code class="literal">
management-server
</code>
RPM downloaded from the
MySQL website):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa47706287"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> mysql-cluster-community-management-server-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>el7<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This RPM installs the management server binary
<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>
in the
<code class="filename">
/usr/sbin
</code>
directory. While this is the only
program actually required for running a management node, it is
also a good idea to have 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>
NDB
Cluster management client available as well. You can obtain this
program, as well as other
<code class="literal">
NDB
</code>
client programs
such as
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
and
<a class="link" href="mysql-cluster-programs-ndb-config.html" title="25.5.7 ndb_config — Extract NDB Cluster Configuration Information">
<span class="command">
<strong>
ndb_config
</strong>
</span>
</a>
, by installing the
<code class="literal">
client
</code>
RPM as described previously.
</p>
<p>
See
<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>
, for general
information about installing MySQL using RPMs supplied by
Oracle.
</p>
<p>
After installing from RPM, you still need to configure the
cluster; 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>
, for the
relevant information.
</p>
<p>
<span class="emphasis">
<em>
It is very important that all of the Cluster RPMs to
be installed have the same version number
</em>
</span>
. The
<em class="replaceable">
<code>
architecture
</code>
</em>
designation should also
be appropriate to the machine on which the RPM is to be
installed; in particular, you should keep in mind that 64-bit
RPMs cannot be used with 32-bit operating systems.
</p>
<p>
<b>
Data nodes.
</b>
On a computer that is to host a cluster data node it is
necessary to install only the
<code class="literal">
server
</code>
RPM.
To do so, copy this RPM to the data node host, and run the
following command as the system root user, replacing the name
shown for the RPM as necessary to match that of the RPM
downloaded from the MySQL website:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa32879500"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> MySQL-Cluster-server-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>i386<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
Although this installs all NDB Cluster binaries, only the
program
<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>
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>
(both in
<code class="filename">
/usr/sbin
</code>
) is actually needed to
run an NDB Cluster data node.
</p>
<p>
<b>
SQL nodes.
</b>
On each machine to be used for hosting a cluster SQL node,
install the
<code class="literal">
server
</code>
RPM by executing the
following command as the system root user, replacing the name
shown for the RPM as necessary to match the name of the RPM
downloaded from the MySQL website:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa89240084"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> MySQL-Cluster-server-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>i386<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This installs the MySQL server binary
(
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
) with
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine support in the
<code class="filename">
/usr/sbin
</code>
directory, as well as all needed
MySQL Server support files. It also installs the
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
and
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
startup scripts (in
<code class="filename">
/usr/share/mysql
</code>
and
<code class="filename">
/usr/bin
</code>
, respectively). The RPM installer
should take care of general configuration issues (such as
creating the
<code class="literal">
mysql
</code>
user and group, if needed)
automatically.
</p>
<p>
To administer the SQL node (MySQL server), you should also
install the
<code class="literal">
client
</code>
RPM, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa34266388"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> MySQL-Cluster-client-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>i386<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
This installs 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.
</p>
<p>
<b>
Management nodes.
</b>
To install the NDB Cluster management server, it is necessary
only to use the
<code class="literal">
server
</code>
RPM. Copy this RPM
to the computer intended to host the management node, and then
install it by running the following command as the system root
user (replace the name shown for the RPM as necessary to match
that of the
<code class="literal">
server
</code>
RPM downloaded from the
MySQL website):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa41505514"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-Uhv</span> MySQL-Cluster-server-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-1<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>i386<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
Although this RPM installs many other files, only the management
server binary
<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>
(in the
<code class="filename">
/usr/sbin
</code>
directory) is actually required
for running a management node. The
<code class="literal">
server
</code>
RPM
also installs
<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>
, the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
management client.
</p>
<p>
See
<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>
, for general
information about installing MySQL using RPMs supplied by
Oracle. 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>
, for
information about required post-installation configuration.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/literals.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="literals">
</a>
11.1 Literal Values
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="string-literals.html">
11.1.1 String Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="number-literals.html">
11.1.2 Numeric Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="date-and-time-literals.html">
11.1.3 Date and Time Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="hexadecimal-literals.html">
11.1.4 Hexadecimal Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bit-value-literals.html">
11.1.5 Bit-Value Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="boolean-literals.html">
11.1.6 Boolean Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="null-values.html">
11.1.7 NULL Values
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045220641376">
</a>
<p>
This section describes how to write literal values in MySQL. These
include strings, numbers, hexadecimal and bit values, boolean
values, and
<code class="literal">
NULL
</code>
. The section also covers
various nuances that you may encounter when dealing with these
basic types in MySQL.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-profiles.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-profiles">
</a>
15.7.7.33 SHOW PROFILES Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045169740912">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa75685929"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROFILES</span></code></pre>
</div>
<p>
The
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW PROFILES
</code>
</a>
statement,
together with
<a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
<code class="literal">
SHOW PROFILE
</code>
</a>
,
displays profiling information that indicates resource usage for
statements executed during the course of the current session.
For more information, see
<a class="xref" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
Section 15.7.7.32, “SHOW PROFILE Statement”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
<code class="literal">
SHOW PROFILE
</code>
</a>
and
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW PROFILES
</code>
</a>
statements are
deprecated; expect it to be removed in a future MySQL release.
Use the
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance
Schema
</a>
instead; see
<a class="xref" href="performance-schema-query-profiling.html" title="29.19.1 Query Profiling Using Performance Schema">
Section 29.19.1, “Query Profiling Using Performance Schema”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-tablespace-encryption.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-tablespace-encryption">
</a>
A.17 MySQL 8.4 FAQ: InnoDB Data-at-Rest Encryption
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045054854464">
</a>
<div class="qandaset">
<a name="idm46045054853008">
</a>
<dl>
<dt>
A.17.1.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-access">
Is data decrypted for users who are authorized to see it?
</a>
</dt>
<dt>
A.17.2.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-overhead">
What is the overhead associated with InnoDB
data-at-rest encryption?
</a>
</dt>
<dt>
A.17.3.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-algorithm">
What are the encryption algorithms used with
InnoDB data-at-rest encryption?
</a>
</dt>
<dt>
A.17.4.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-other-algorithms">
Is it possible to use 3rd party encryption algorithms in place
of the one provided by the InnoDB
data-at-rest encryption feature?
</a>
</dt>
<dt>
A.17.5.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-indexed-columns">
Can indexed columns be encrypted?
</a>
</dt>
<dt>
A.17.6.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-data-types">
What data types and data lengths does InnoDB
data-at-rest encryption support?
</a>
</dt>
<dt>
A.17.7.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-network">
Does data remain encrypted on the network?
</a>
</dt>
<dt>
A.17.8.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-database-memory">
Does database memory contain cleartext or encrypted data?
</a>
</dt>
<dt>
A.17.9.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-data-to-encrypt">
How do I know which data to encrypt?
</a>
</dt>
<dt>
A.17.10.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-mysql-encryption">
How is InnoDB data-at-rest encryption
different from encryption functions MySQL already provides?
</a>
</dt>
<dt>
A.17.11.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-transportable-tablespaces">
Does the transportable tablespaces feature work with
InnoDB data-at-rest encryption?
</a>
</dt>
<dt>
A.17.12.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-compression">
Does compression work with InnoDB
data-at-rest encryption?
</a>
</dt>
<dt>
A.17.13.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-mysqldump">
Can I use mysqldump with encrypted tables?
</a>
</dt>
<dt>
A.17.14.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-key-rotation">
How do I change (rotate, re-key) the master encryption key?
</a>
</dt>
<dt>
A.17.15.
<a href="faqs-tablespace-encryption.html#faq-tablespace-encryption-data-migration">
How do I migrate data from a cleartext InnoDB
tablespace to an encrypted InnoDB tablespace?
</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-tablespace-encryption-access">
</a>
<a name="idm46045054852256">
</a>
<p>
<b>
A.17.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Is data decrypted for users who are authorized to see it?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes.
<code class="literal">
InnoDB
</code>
data-at-rest encryption is
designed to transparently apply encryption within the database
without impacting existing applications. Returning data in
encrypted format would break most existing applications.
<code class="literal">
InnoDB
</code>
data-at-rest encryption provides the
benefit of encryption without the overhead associated with
traditional database encryption solutions, which would typically
require expensive and substantial changes to applications,
database triggers, and views.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-overhead">
</a>
<a name="idm46045054848336">
</a>
<p>
<b>
A.17.2.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
What is the overhead associated with
<code class="literal">
InnoDB
</code>
data-at-rest encryption?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
There is no additional storage overhead. According to internal
benchmarks, performance overhead amounts to a single digit
percentage difference.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-algorithm">
</a>
<a name="idm46045054845472">
</a>
<p>
<b>
A.17.3.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
What are the encryption algorithms used with
<code class="literal">
InnoDB
</code>
data-at-rest encryption?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
<code class="literal">
InnoDB
</code>
data-at-rest encryption supports the
Advanced Encryption Standard (AES256) block-based encryption
algorithm. It uses Electronic Codebook (ECB) block encryption
mode for tablespace key encryption and Cipher Block Chaining
(CBC) block encryption mode for data encryption.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-other-algorithms">
</a>
<a name="idm46045054841360">
</a>
<p>
<b>
A.17.4.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Is it possible to use 3rd party encryption algorithms in place
of the one provided by the
<code class="literal">
InnoDB
</code>
data-at-rest encryption feature?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
No, it is not possible to use other encryption algorithms. The
provided encryption algorithm is broadly accepted.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-indexed-columns">
</a>
<a name="idm46045054838368">
</a>
<p>
<b>
A.17.5.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can indexed columns be encrypted?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
<code class="literal">
InnoDB
</code>
data-at-rest encryption supports all
indexes transparently.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-data-types">
</a>
<a name="idm46045054835680">
</a>
<p>
<b>
A.17.6.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
What data types and data lengths does
<code class="literal">
InnoDB
</code>
data-at-rest encryption support?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
<code class="literal">
InnoDB
</code>
data-at-rest encryption supports all
supported data types. There is no data length limitation.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-network">
</a>
<a name="idm46045054832128">
</a>
<p>
<b>
A.17.7.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does data remain encrypted on the network?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Data encrypted by the
<code class="literal">
InnoDB
</code>
data-at-rest
feature is decrypted when it is read from the tablespace file.
Thus, if the data is on the network, it is in cleartext form.
However, data on the network can be encrypted using MySQL
network encryption, which encrypts data traveling to and from a
database using SSL/TLS.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-database-memory">
</a>
<a name="idm46045054828992">
</a>
<p>
<b>
A.17.8.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does database memory contain cleartext or encrypted data?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
With
<code class="literal">
InnoDB
</code>
data-at-rest encryption,
in-memory data is decrypted, which provides complete
transparency.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-data-to-encrypt">
</a>
<a name="idm46045054826096">
</a>
<p>
<b>
A.17.9.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
How do I know which data to encrypt?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Compliance with the PCI-DSS standard requires that credit card
numbers (Primary Account Number, or 'PAN') be stored in
encrypted form. Breach Notification Laws (for example, CA SB
1386, CA AB 1950, and similar laws in 43+ more US states)
require encryption of first name, last name, driver license
number, and other PII data. In early 2008, CA AB 1298 added
medical and health insurance information to PII data.
Additionally, industry specific privacy and security standards
may require encryption of certain assets. For example, assets
such as pharmaceutical research results, oil field exploration
results, financial contracts, or personal data of law
enforcement informants may require encryption. In the health
care industry, the privacy of patient data, health records and
X-ray images is of the highest importance.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-mysql-encryption">
</a>
<a name="idm46045054823120">
</a>
<p>
<b>
A.17.10.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
How is
<code class="literal">
InnoDB
</code>
data-at-rest encryption
different from encryption functions MySQL already provides?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
There are symmetric and asymmetric encryption APIs in MySQL that
can be used to manually encrypt data within the database.
However, the application must manage encryption keys and perform
required encryption and decryption operations by calling API
functions.
<code class="literal">
InnoDB
</code>
data-at-rest encryption
requires no application changes, is transparent to end users,
and provides automated, built-in key management.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-transportable-tablespaces">
</a>
<a name="idm46045054819216">
</a>
<p>
<b>
A.17.11.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does the transportable tablespaces feature work with
<code class="literal">
InnoDB
</code>
data-at-rest encryption?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. It is supported for encrypted file-per-table tablespaces.
For more information, see
<a class="xref" href="innodb-data-encryption.html#innodb-data-encryption-exporting" title="Exporting Encrypted Tablespaces">
Exporting Encrypted Tablespaces
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-compression">
</a>
<a name="idm46045054815664">
</a>
<p>
<b>
A.17.12.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does compression work with
<code class="literal">
InnoDB
</code>
data-at-rest encryption?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Customers using
<code class="literal">
InnoDB
</code>
data-at-rest
encryption receive the full benefit of compression because
compression is applied before data blocks are encrypted.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-mysqldump">
</a>
<a name="idm46045054812096">
</a>
<p>
<b>
A.17.13.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can I use
<code class="literal">
mysqldump
</code>
with encrypted tables?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes. Because these utilities create logical backups, the data
dumped from encrypted tables is not encrypted.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-key-rotation">
</a>
<a name="idm46045054809328">
</a>
<p>
<b>
A.17.14.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
How do I change (rotate, re-key) the master encryption key?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
<code class="literal">
InnoDB
</code>
data-at-rest encryption uses a two
tier key mechanism. When data-at-rest encryption is used,
individual tablespace keys are stored in the header of the
underlying tablespace data file. Tablespace keys are encrypted
using the master encryption key. The master encryption key is
generated when tablespace encryption is enabled, and is stored
outside the database. The master encryption key is rotated using
the
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER
INSTANCE ROTATE INNODB MASTER KEY
</code>
</a>
statement, which
generates a new master encryption key, stores the key, and
rotates the key into use.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-tablespace-encryption-data-migration">
</a>
<a name="idm46045054804784">
</a>
<p>
<b>
A.17.15.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
How do I migrate data from a cleartext
<code class="literal">
InnoDB
</code>
tablespace to an encrypted
<code class="literal">
InnoDB
</code>
tablespace?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Transferring data from one tablespace to another is not
required. To encrypt data in an
<code class="literal">
InnoDB
</code>
file-per-table tablespace, run
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
<em class="replaceable">
<code>
tbl_name
</code>
</em>
ENCRYPTION = 'Y'
</code>
</a>
.
To encrypt a general tablespace or the
<code class="literal">
mysql
</code>
tablespace, run
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
TABLESPACE
<em class="replaceable">
<code>
tablespace_name
</code>
</em>
ENCRYPTION
= 'Y'
</code>
</a>
. Encryption support for general tablespaces was
introduced in MySQL 8.0.13. Encryption support for the
<code class="literal">
mysql
</code>
system tablespace is available as of
MySQL 8.0.16.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/telemetry.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="telemetry">
</a>
Chapter 35 Telemetry
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="telemetry-trace-install.html">
35.1 Installing OpenTelemetry Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-system-variables.html">
35.2 Telemetry Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-trace.html">
35.3 OpenTelemetry Trace
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="telemetry-trace-configuration.html">
35.3.1 Configuring Trace Telemetry
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-trace-format.html">
35.3.2 Trace Format
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="telemetry-metrics.html">
35.4 OpenTelemetry Metrics
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="telemetry-metrics-configuration.html">
35.4.1 Configuring Metrics Telemetry
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-metrics-meters.html">
35.4.2 Server Meters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-metrics-meter-metrics.html">
35.4.3 Server Metrics
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>
The OpenTelemetry (OTel) project is an open-source, vendor-neutral
observability framework, providing a common observability standard.
It enables users to instrument their applications in order to export
observability data: traces, metrics and logs, enabling increased
granularity of debugging and testing.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This chapter assumes familiarity with the
<a class="ulink" href="https://opentelemetry.io/" target="_blank">
OpenTelemetry
Documentation
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/data-types.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="data-types">
</a>
Chapter 13 Data Types
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="numeric-types.html">
13.1 Numeric Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="numeric-type-syntax.html">
13.1.1 Numeric Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="integer-types.html">
13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT,
MEDIUMINT, BIGINT
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fixed-point-types.html">
13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="floating-point-types.html">
13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bit-type.html">
13.1.5 Bit-Value Type - BIT
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="numeric-type-attributes.html">
13.1.6 Numeric Type Attributes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="out-of-range-and-overflow.html">
13.1.7 Out-of-Range and Overflow Handling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="date-and-time-types.html">
13.2 Date and Time Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="date-and-time-type-syntax.html">
13.2.1 Date and Time Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="datetime.html">
13.2.2 The DATE, DATETIME, and TIMESTAMP Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="time.html">
13.2.3 The TIME Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="year.html">
13.2.4 The YEAR Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="timestamp-initialization.html">
13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fractional-seconds.html">
13.2.6 Fractional Seconds in Time Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-calendar.html">
13.2.7 What Calendar Is Used By MySQL?
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="date-and-time-type-conversion.html">
13.2.8 Conversion Between Date and Time Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="two-digit-years.html">
13.2.9 2-Digit Years in Dates
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="string-types.html">
13.3 String Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="string-type-syntax.html">
13.3.1 String Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="char.html">
13.3.2 The CHAR and VARCHAR Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="binary-varbinary.html">
13.3.3 The BINARY and VARBINARY Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="blob.html">
13.3.4 The BLOB and TEXT Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enum.html">
13.3.5 The ENUM Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set.html">
13.3.6 The SET Type
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="spatial-types.html">
13.4 Spatial Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="spatial-type-overview.html">
13.4.1 Spatial Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="opengis-geometry-model.html">
13.4.2 The OpenGIS Geometry Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-data-formats.html">
13.4.3 Supported Spatial Data Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="geometry-well-formedness-validity.html">
13.4.4 Geometry Well-Formedness and Validity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-reference-systems.html">
13.4.5 Spatial Reference System Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-columns.html">
13.4.6 Creating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="populating-spatial-columns.html">
13.4.7 Populating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fetching-spatial-data.html">
13.4.8 Fetching Spatial Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-spatial-analysis.html">
13.4.9 Optimizing Spatial Analysis
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-indexes.html">
13.4.10 Creating Spatial Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-spatial-indexes.html">
13.4.11 Using Spatial Indexes
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="json.html">
13.5 The JSON Data Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-type-defaults.html">
13.6 Data Type Default Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="storage-requirements.html">
13.7 Data Type Storage Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="choosing-types.html">
13.8 Choosing the Right Type for a Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="other-vendor-data-types.html">
13.9 Using Data Types from Other Database Engines
</a>
</span>
</dt>
</dl>
</div>
<p>
MySQL supports
<a class="link" href="glossary.html#glos_sql" title="SQL">
SQL
</a>
data types in
several categories: numeric types, date and time types, string
(character and byte) types, spatial types, and the
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
data type. This chapter provides
an overview and more detailed description of the properties of the
types in each category, and a summary of the data type storage
requirements. The initial overviews are intentionally brief. Consult
the more detailed descriptions for additional information about
particular data types, such as the permissible formats in which you
can specify values.
</p>
<a class="indexterm" name="idm46045214498624">
</a>
<a class="indexterm" name="idm46045214497552">
</a>
<a class="indexterm" name="idm46045214496064">
</a>
<a class="indexterm" name="idm46045214494576">
</a>
<p>
Data type descriptions use these conventions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For integer types,
<em class="replaceable">
<code>
M
</code>
</em>
indicates the
maximum display width. For floating-point and fixed-point types,
<em class="replaceable">
<code>
M
</code>
</em>
is the total number of digits that
can be stored (the precision). For string types,
<em class="replaceable">
<code>
M
</code>
</em>
is the maximum length. The maximum
permissible value of
<em class="replaceable">
<code>
M
</code>
</em>
depends on the
data type.
</p>
<a class="indexterm" name="idm46045214489792">
</a>
<a class="indexterm" name="idm46045214488720">
</a>
<a class="indexterm" name="idm46045214487232">
</a>
<a class="indexterm" name="idm46045214486160">
</a>
<a class="indexterm" name="idm46045214484672">
</a>
<a class="indexterm" name="idm46045214483600">
</a>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045214481472">
</a>
<a class="indexterm" name="idm46045214480400">
</a>
<a class="indexterm" name="idm46045214478912">
</a>
<a class="indexterm" name="idm46045214477840">
</a>
<em class="replaceable">
<code>
D
</code>
</em>
applies to floating-point and
fixed-point types and indicates the number of digits following
the decimal point (the scale). The maximum possible value is 30,
but should be no greater than
<em class="replaceable">
<code>
M
</code>
</em>
−2.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
fsp
</code>
</em>
applies to the
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
,
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</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>
types and represents
fractional seconds precision; that is, the number of digits
following the decimal point for fractional parts of seconds. The
<em class="replaceable">
<code>
fsp
</code>
</em>
value, if given, must be in the
range 0 to 6. A value of 0 signifies that there is no fractional
part. If omitted, the default precision is 0. (This differs from
the standard SQL default of 6, for compatibility with previous
MySQL versions.)
</p>
<a class="indexterm" name="idm46045214469808">
</a>
<a class="indexterm" name="idm46045214468720">
</a>
</li>
<li class="listitem">
<p>
Square brackets (
<code class="literal">
[
</code>
and
<code class="literal">
]
</code>
)
indicate optional parts of type definitions.
</p>
<a class="indexterm" name="idm46045214464992">
</a>
<a class="indexterm" name="idm46045214463504">
</a>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-enterprise-security">
</a>
32.2 MySQL Enterprise Security Overview
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060245648">
</a>
<a class="indexterm" name="idm46045060244560">
</a>
<p>
MySQL Enterprise Edition provides plugins that implement security features using
external services:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL Enterprise Edition includes an authentication plugin that enables MySQL
Server to use LDAP (Lightweight Directory Access Protocol) to
authenticate MySQL users. LDAP Authentications supports user
name and password, SASL, and GSSAPI/Kerberos authentication
methods to LDAP services. For more information, see
<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>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes an authentication plugin that enables MySQL
Server to use Native Kerberos to authenticate MySQL users
using there Kerberos Principals. For more information, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes an authentication plugin that enables MySQL
Server to use PAM (Pluggable Authentication Modules) to
authenticate MySQL users. PAM enables a system to use a
standard interface to access various kinds of authentication
methods, such as Unix passwords or an LDAP directory. For more
information, 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>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes an authentication plugin that performs external
authentication on Windows, enabling MySQL Server to use native
Windows services to authenticate client connections. Users who
have logged in to Windows can connect from MySQL client
programs to the server based on the information in their
environment without specifying an additional password. For
more information, see
<a class="xref" href="windows-pluggable-authentication.html" title="8.4.1.6 Windows Pluggable Authentication">
Section 8.4.1.6, “Windows Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes a suite of masking and de-identification
functions that perform subsetting, random generation, and
dictionary replacement to de-identify strings, numerics, phone
numbers, emails and more. These functions enable masking
existing data using several methods such as obfuscation
(removing identifying characteristics), generation of
formatted random data, and data replacement or substitution.
For more information, see
<a class="xref" href="data-masking.html" title="8.5 MySQL Enterprise Data Masking and De-Identification">
Section 8.5, “MySQL Enterprise Data Masking and De-Identification”
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes a set of encryption functions based on the
OpenSSL library that expose OpenSSL capabilities at the SQL
level. For more information, see
<a class="xref" href="mysql-enterprise-encryption.html" title="32.3 MySQL Enterprise Encryption Overview">
Section 32.3, “MySQL Enterprise Encryption Overview”
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition 5.7 and higher includes a keyring plugin that uses
Oracle Key Vault as a backend for keyring storage. For more
information, see
<a class="xref" href="keyring.html" title="8.4.4 The MySQL Keyring">
Section 8.4.4, “The MySQL Keyring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Transparent Data Encryption (TDE) provides at-rest
encryption for MySQL Server for all files that might contain
sensitive data. For more information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
,
<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>
, and
<a class="xref" href="audit-log-logging-configuration.html#audit-log-file-encryption" title="Encrypting Audit Log Files">
Encrypting Audit Log Files
</a>
.
</p>
</li>
</ul>
</div>
<p>
For other related Enterprise security features, see
<a class="xref" href="mysql-enterprise-encryption.html" title="32.3 MySQL Enterprise Encryption Overview">
Section 32.3, “MySQL Enterprise Encryption Overview”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-multi-source-reset-replica.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-multi-source-reset-replica">
</a>
19.1.5.7 Resetting Multi-Source Replicas
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045145143760">
</a>
<p>
The
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
statement can be
used to reset a multi-source replica. By default, if you use the
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
statement on a
multi-source replica all channels are reset. Optionally, use the
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause to reset only a specific channel.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To reset all currently configured replication channels:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa34271379"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">REPLICA</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To reset only a named channel, use a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59615972"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">REPLICA</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_1"</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
For GTID-based replication, note that
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET
REPLICA
</code>
</a>
has no effect on the replica's GTID
execution history. If you want to clear this, issue
<a class="link" href="reset-binary-logs-and-gtids.html" title="15.4.1.2 RESET BINARY LOGS AND GTIDS Statement">
<code class="literal">
RESET BINARY LOGS AND GTIDS
</code>
</a>
on the
replica.
</p>
<p>
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
makes the replica
forget its replication position, and clears the relay log, but it
does not change any replication connection parameters (such as the
source host name) or replication filters. If you want to remove
these for a channel, issue
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
ALL
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-table-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-table-reference">
</a>
28.4.1 INFORMATION_SCHEMA InnoDB Table Reference
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045077901056">
</a>
<a class="indexterm" name="idm46045077899568">
</a>
<p>
The following table summarizes
<code class="literal">
INFORMATION_SCHEMA
</code>
InnoDB tables. For greater
detail, see the individual table descriptions.
</p>
<div class="table">
<a name="idm46045077896848">
</a>
<p class="title">
<b>
Table 28.3 INFORMATION_SCHEMA InnoDB Tables
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists INFORMATION_SCHEMA InnoDB tables.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Table Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="information-schema-innodb-buffer-page-table.html" title="28.4.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table">
<code class="literal">
INNODB_BUFFER_PAGE
</code>
</a>
</td>
<td>
Pages in InnoDB buffer pool
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-buffer-page-lru-table.html" title="28.4.3 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table">
<code class="literal">
INNODB_BUFFER_PAGE_LRU
</code>
</a>
</td>
<td>
LRU ordering of pages in InnoDB buffer pool
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-buffer-pool-stats-table.html" title="28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table">
<code class="literal">
INNODB_BUFFER_POOL_STATS
</code>
</a>
</td>
<td>
InnoDB buffer pool statistics
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-cached-indexes-table.html" title="28.4.5 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table">
<code class="literal">
INNODB_CACHED_INDEXES
</code>
</a>
</td>
<td>
Number of index pages cached per index in InnoDB buffer pool
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Status for operations related to compressed InnoDB tables
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-cmp-per-index-table.html" title="28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables">
<code class="literal">
INNODB_CMP_PER_INDEX
</code>
</a>
</td>
<td>
Status for operations related to compressed InnoDB tables and indexes
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-cmp-per-index-table.html" title="28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables">
<code class="literal">
INNODB_CMP_PER_INDEX_RESET
</code>
</a>
</td>
<td>
Status for operations related to compressed InnoDB tables and indexes
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Status for operations related to compressed InnoDB tables
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Status for compressed pages within InnoDB buffer pool
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Status for compressed pages within InnoDB buffer pool
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-columns-table.html" title="28.4.9 The INFORMATION_SCHEMA INNODB_COLUMNS Table">
<code class="literal">
INNODB_COLUMNS
</code>
</a>
</td>
<td>
Columns in each InnoDB table
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Data file path information for InnoDB file-per-table and general tablespaces
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-fields-table.html" title="28.4.11 The INFORMATION_SCHEMA INNODB_FIELDS Table">
<code class="literal">
INNODB_FIELDS
</code>
</a>
</td>
<td>
Key columns of InnoDB indexes
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-foreign-table.html" title="28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table">
<code class="literal">
INNODB_FOREIGN
</code>
</a>
</td>
<td>
InnoDB foreign-key metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-foreign-cols-table.html" title="28.4.13 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table">
<code class="literal">
INNODB_FOREIGN_COLS
</code>
</a>
</td>
<td>
InnoDB foreign-key column status information
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-being-deleted-table.html" title="28.4.14 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table">
<code class="literal">
INNODB_FT_BEING_DELETED
</code>
</a>
</td>
<td>
Snapshot of INNODB_FT_DELETED table
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-config-table.html" title="28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table">
<code class="literal">
INNODB_FT_CONFIG
</code>
</a>
</td>
<td>
Metadata for InnoDB table FULLTEXT index and associated processing
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-default-stopword-table.html" title="28.4.16 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table">
<code class="literal">
INNODB_FT_DEFAULT_STOPWORD
</code>
</a>
</td>
<td>
Default list of stopwords for InnoDB FULLTEXT indexes
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-deleted-table.html" title="28.4.17 The INFORMATION_SCHEMA INNODB_FT_DELETED Table">
<code class="literal">
INNODB_FT_DELETED
</code>
</a>
</td>
<td>
Rows deleted from InnoDB table FULLTEXT index
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-index-cache-table.html" title="28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table">
<code class="literal">
INNODB_FT_INDEX_CACHE
</code>
</a>
</td>
<td>
Token information for newly inserted rows in InnoDB FULLTEXT index
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-ft-index-table-table.html" title="28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table">
<code class="literal">
INNODB_FT_INDEX_TABLE
</code>
</a>
</td>
<td>
Inverted index information for processing text searches against InnoDB table FULLTEXT index
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-indexes-table.html" title="28.4.20 The INFORMATION_SCHEMA INNODB_INDEXES Table">
<code class="literal">
INNODB_INDEXES
</code>
</a>
</td>
<td>
InnoDB index metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
</td>
<td>
InnoDB performance information
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-session-temp-tablespaces-table.html" title="28.4.22 The INFORMATION_SCHEMA INNODB_SESSION_TEMP_TABLESPACES Table">
<code class="literal">
INNODB_SESSION_TEMP_TABLESPACES
</code>
</a>
</td>
<td>
Session temporary-tablespace metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-tables-table.html" title="28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table">
<code class="literal">
INNODB_TABLES
</code>
</a>
</td>
<td>
InnoDB table metadata
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
InnoDB file-per-table, general, and undo tablespace metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-tablespaces-brief-table.html" title="28.4.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table">
<code class="literal">
INNODB_TABLESPACES_BRIEF
</code>
</a>
</td>
<td>
Brief file-per-table, general, undo, and system tablespace metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-tablestats-table.html" title="28.4.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View">
<code class="literal">
INNODB_TABLESTATS
</code>
</a>
</td>
<td>
InnoDB table low-level status information
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-temp-table-info-table.html" title="28.4.27 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table">
<code class="literal">
INNODB_TEMP_TABLE_INFO
</code>
</a>
</td>
<td>
Information about active user-created InnoDB temporary tables
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
</td>
<td>
Active InnoDB transaction information
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-innodb-virtual-table.html" title="28.4.29 The INFORMATION_SCHEMA INNODB_VIRTUAL Table">
<code class="literal">
INNODB_VIRTUAL
</code>
</a>
</td>
<td>
InnoDB virtual generated column metadata
</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: 258.891px;">
Table Name
</th>
<th style="width: 479.109px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/resignal.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="resignal">
</a>
15.6.7.4 RESIGNAL Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045175817936">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63001297"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span> <span class="token punctuation">[</span><em class="replaceable">condition_value</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">SET</span> <em class="replaceable">signal_information_item</em>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">signal_information_item</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>
<em class="replaceable">condition_value</em>: {
<span class="token keyword">SQLSTATE</span> <span class="token punctuation">[</span><span class="token keyword">VALUE</span><span class="token punctuation">]</span> <em class="replaceable">sqlstate_value</em>
<span class="token operator">|</span> <em class="replaceable">condition_name</em>
}
<em class="replaceable">signal_information_item</em>:
<em class="replaceable">condition_information_item_name</em> <span class="token operator">=</span> <em class="replaceable">simple_value_specification</em>
<em class="replaceable">condition_information_item_name</em>: {
<span class="token keyword">CLASS_ORIGIN</span>
<span class="token operator">|</span> <span class="token keyword">SUBCLASS_ORIGIN</span>
<span class="token operator">|</span> <span class="token keyword">MESSAGE_TEXT</span>
<span class="token operator">|</span> <span class="token keyword">MYSQL_ERRNO</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_CATALOG</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_SCHEMA</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_NAME</span>
<span class="token operator">|</span> <span class="token keyword">CATALOG_NAME</span>
<span class="token operator">|</span> <span class="token keyword">SCHEMA_NAME</span>
<span class="token operator">|</span> <span class="token keyword">TABLE_NAME</span>
<span class="token operator">|</span> <span class="token keyword">COLUMN_NAME</span>
<span class="token operator">|</span> <span class="token keyword">CURSOR_NAME</span>
}
<em class="replaceable">condition_name</em><span class="token punctuation">,</span> <em class="replaceable">simple_value_specification</em>:
<span class="token punctuation">(</span>see <span class="token keyword">following</span> discussion<span class="token punctuation">)</span></code></pre>
</div>
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
passes on the error
condition information that is available during execution of a
condition handler within a compound statement inside a stored
procedure or function, trigger, or event.
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
may change some or all
information before passing it on.
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
is related to
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
, but instead of
originating a condition as
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
does,
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
relays existing
condition information, possibly after modifying it.
</p>
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
makes it possible to
both handle an error and return the error information.
Otherwise, by executing an SQL statement within the handler,
information that caused the handler's activation is destroyed.
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
also can make some
procedures shorter if a given handler can handle part of a
situation, then pass the condition
<span class="quote">
“
<span class="quote">
up the line
</span>
”
</span>
to
another handler.
</p>
<p>
No privileges are required to execute the
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statement.
</p>
<p>
All forms of
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
require
that the current context be a condition handler. Otherwise,
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
is illegal and a
<code class="literal">
RESIGNAL when handler not active
</code>
error
occurs.
</p>
<p>
To retrieve information from the diagnostics area, use the
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
statement (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>
). For information about the
diagnostics area, see
<a class="xref" href="diagnostics-area.html" title="15.6.7.7 The MySQL Diagnostics Area">
Section 15.6.7.7, “The MySQL Diagnostics Area”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="resignal.html#resignal-overview" title="RESIGNAL Overview">
RESIGNAL Overview
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="resignal.html#resignal-alone" title="RESIGNAL Alone">
RESIGNAL Alone
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="resignal.html#resignal-with-new-signal" title="RESIGNAL with New Signal Information">
RESIGNAL with New Signal Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="resignal.html#resignal-with-condition" title="RESIGNAL with a Condition Value and Optional New Signal Information">
RESIGNAL with a Condition Value and Optional New Signal Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="resignal.html#resignal-handler" title="RESIGNAL Requires Condition Handler Context">
RESIGNAL Requires Condition Handler Context
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="resignal-overview">
</a>
RESIGNAL Overview
</h5>
</div>
</div>
</div>
<p>
For
<em class="replaceable">
<code>
condition_value
</code>
</em>
and
<em class="replaceable">
<code>
signal_information_item
</code>
</em>
, the
definitions and rules are the same for
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
as for
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
. For example, the
<em class="replaceable">
<code>
condition_value
</code>
</em>
can be an
<code class="literal">
SQLSTATE
</code>
value, and the value can indicate
errors, warnings, or
<span class="quote">
“
<span class="quote">
not found.
</span>
”
</span>
For additional
information, see
<a class="xref" href="signal.html" title="15.6.7.5 SIGNAL Statement">
Section 15.6.7.5, “SIGNAL Statement”
</a>
.
</p>
<p>
The
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statement takes
<em class="replaceable">
<code>
condition_value
</code>
</em>
and
<code class="literal">
SET
</code>
clauses, both of which are optional.
This leads to several possible uses:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31253123"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
with new signal
information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa18378507"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span> <span class="token keyword">SET</span> <em class="replaceable">signal_information_item</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">signal_information_item</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></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
with a condition
value and possibly new signal information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4320496"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span> <em class="replaceable">condition_value</em>
<span class="token punctuation">[</span><span class="token keyword">SET</span> <em class="replaceable">signal_information_item</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">signal_information_item</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></code></pre>
</div>
</li>
</ul>
</div>
<p>
These use cases all cause changes to the diagnostics and
condition areas:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A diagnostics area contains one or more condition areas.
</p>
</li>
<li class="listitem">
<p>
A condition area contains condition information items,
such as the
<code class="literal">
SQLSTATE
</code>
value,
<code class="literal">
MYSQL_ERRNO
</code>
, or
<code class="literal">
MESSAGE_TEXT
</code>
.
</p>
</li>
</ul>
</div>
<p>
There is a stack of diagnostics areas. When a handler takes
control, it pushes a diagnostics area to the top of the stack,
so there are two diagnostics areas during handler execution:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The first (current) diagnostics area, which starts as a
copy of the last diagnostics area, but is overwritten by
the first statement in the handler that changes the
current diagnostics area.
</p>
</li>
<li class="listitem">
<p>
The last (stacked) diagnostics area, which has the
condition areas that were set up before the handler took
control.
</p>
</li>
</ul>
</div>
<p>
The maximum number of condition areas in a diagnostics area is
determined by the value of the
<a class="link" href="server-system-variables.html#sysvar_max_error_count">
<code class="literal">
max_error_count
</code>
</a>
system
variable. See
<a class="xref" href="diagnostics-area.html#diagnostics-area-system-variables" title="Diagnostics Area-Related System Variables">
Diagnostics Area-Related System Variables
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="resignal-alone">
</a>
RESIGNAL Alone
</h5>
</div>
</div>
</div>
<p>
A simple
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone means
<span class="quote">
“
<span class="quote">
pass on the error with no change.
</span>
”
</span>
It restores
the last diagnostics area and makes it the current diagnostics
area. That is, it
<span class="quote">
“
<span class="quote">
pops
</span>
”
</span>
the diagnostics area
stack.
</p>
<p>
Within a condition handler that catches a condition, one use
for
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone is to
perform some other actions, and then pass on without change
the original condition information (the information that
existed before entry into the handler).
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95698748"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> xx<span class="token punctuation">;</span>
<span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token variable">@error_count</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">IF</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span> <span class="token keyword">THEN</span> <span class="token keyword">RESIGNAL</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">END</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> xx<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token comment" spellcheck="true">//</span>
<span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose that the
<code class="literal">
DROP TABLE xx
</code>
statement
fails. The diagnostics area stack looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa90528323"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 1051 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
Then execution enters the
<code class="literal">
EXIT
</code>
handler. It
starts by pushing a diagnostics area to the top of the stack,
which now looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa73146185"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 1051 (42S02): Unknown table 'xx'
DA 2. ERROR 1051 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
At this point, the contents of the first (current) and second
(stacked) diagnostics areas are the same. The first
diagnostics area may be modified by statements executing
subsequently within the handler.
</p>
<p>
Usually a procedure statement clears the first diagnostics
area.
<code class="literal">
BEGIN
</code>
is an exception, it does not
clear, it does nothing.
<code class="literal">
SET
</code>
is not an
exception, it clears, performs the operation, and produces a
result of
<span class="quote">
“
<span class="quote">
success.
</span>
”
</span>
The diagnostics area stack
now looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa70021295"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 0000 (00000): Successful operation
DA 2. ERROR 1051 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
At this point, if
<code class="literal">
@a = 0
</code>
,
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
pops the diagnostics
area stack, which now looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa53857965"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 1051 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
And that is what the caller sees.
</p>
<p>
If
<code class="literal">
@a
</code>
is not 0, the handler simply ends,
which means that there is no more use for the current
diagnostics area (it has been
<span class="quote">
“
<span class="quote">
handled
</span>
”
</span>
), so it
can be thrown away, causing the stacked diagnostics area to
become the current diagnostics area again. The diagnostics
area stack looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa20428587"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 0000 (00000): Successful operation</code></pre>
</div>
<p>
The details make it look complex, but the end result is quite
useful: Handlers can execute without destroying information
about the condition that caused activation of the handler.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="resignal-with-new-signal">
</a>
RESIGNAL with New Signal Information
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
with a
<code class="literal">
SET
</code>
clause provides new signal information,
so the statement means
<span class="quote">
“
<span class="quote">
pass on the error with
changes
</span>
”
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa71624340"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span> <span class="token keyword">SET</span> <em class="replaceable">signal_information_item</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">signal_information_item</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></code></pre>
</div>
<p>
As with
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone, the
idea is to pop the diagnostics area stack so that the original
information goes out. Unlike
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone, anything
specified in the
<code class="literal">
SET
</code>
clause changes.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2364237"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> xx<span class="token punctuation">;</span>
<span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token variable">@error_count</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">IF</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span> <span class="token keyword">THEN</span> <span class="token keyword">RESIGNAL</span> <span class="token keyword">SET</span> <span class="token keyword">MYSQL_ERRNO</span> <span class="token operator">=</span> <span class="token number">5</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">END</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> xx<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token comment" spellcheck="true">//</span>
<span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Remember from the previous discussion that
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone results in a
diagnostics area stack like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa63585509"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 1051 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
The
<code class="literal">
RESIGNAL SET MYSQL_ERRNO = 5
</code>
statement
results in this stack instead, which is what the caller sees:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa98638956"><div class="copy-help left">Press ⌘+C to 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">DA 1. ERROR 5 (42S02): Unknown table 'xx'</code></pre>
</div>
<p>
In other words, it changes the error number, and nothing else.
</p>
<p>
The
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statement can
change any or all of the signal information items, making the
first condition area of the diagnostics area look quite
different.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="resignal-with-condition">
</a>
RESIGNAL with a Condition Value and Optional New Signal Information
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
with a condition value
means
<span class="quote">
“
<span class="quote">
push a condition into the current diagnostics
area.
</span>
”
</span>
If the
<code class="literal">
SET
</code>
clause is present,
it also changes the error information.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96860286"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESIGNAL</span> <em class="replaceable">condition_value</em>
<span class="token punctuation">[</span><span class="token keyword">SET</span> <em class="replaceable">signal_information_item</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">signal_information_item</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></code></pre>
</div>
<p>
This form of
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
restores
the last diagnostics area and makes it the current diagnostics
area. That is, it
<span class="quote">
“
<span class="quote">
pops
</span>
”
</span>
the diagnostics area
stack, which is the same as what a simple
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
alone would do.
However, it also changes the diagnostics area depending on the
condition value or signal information.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92216884"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> xx<span class="token punctuation">;</span>
<span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token variable">@error_count</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">IF</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span> <span class="token keyword">THEN</span> <span class="token keyword">RESIGNAL</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'45000'</span> <span class="token keyword">SET</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token operator">=</span><span class="token number">5</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">END</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> xx<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token comment" spellcheck="true">//</span>
<span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@error_count</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@max_error_count</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">ERRORS</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This is similar to the previous example, and the effects are
the same, except that if
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
happens, the current
condition area looks different at the end. (The reason the
condition adds to rather than replaces the existing condition
is the use of a condition value.)
</p>
<p>
The
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statement includes
a condition value (
<code class="literal">
SQLSTATE '45000'
</code>
), so it
adds a new condition area, resulting in a diagnostics area
stack that looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa56320042"><div class="copy-help left">Press ⌘+C to 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">DA 1. (condition 2) ERROR 1051 (42S02): Unknown table 'xx'
(condition 1) ERROR 5 (45000) Unknown table 'xx'</code></pre>
</div>
<p>
The result of
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
p()
</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>
for this example is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79686675"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 5 (45000)<span class="token punctuation">:</span> Unknown table 'xx'</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">ERRORS</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> 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>
<span class="token output"><span class="token punctuation">|</span> Error <span class="token punctuation">|</span> 1051 <span class="token punctuation">|</span> Unknown table 'xx' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Error <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> Unknown table 'xx' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">
<h5 class="title">
<a name="resignal-handler">
</a>
RESIGNAL Requires Condition Handler Context
</h5>
</div>
</div>
</div>
<p>
All forms of
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
require
that the current context be a condition handler. Otherwise,
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
is illegal and a
<code class="literal">
RESIGNAL when handler not active
</code>
error
occurs. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30330874"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">RESIGNAL</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1645 (0K000)<span class="token punctuation">:</span> RESIGNAL when handler not active</span></code></pre>
</div>
<p>
Here is a more difficult example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32373522"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> f <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 keyword">BEGIN</span>
<span class="token keyword">RESIGNAL</span><span class="token punctuation">;</span>
<span class="token keyword">RETURN</span> <span class="token number">5</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span> <span class="token keyword">SET</span> <span class="token variable">@a</span><span class="token operator">=</span>f<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SIGNAL</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'55555'</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token comment" spellcheck="true">//</span>
<span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token keyword">CALL</span> p<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
occurs within the
stored function
<code class="literal">
f()
</code>
. Although
<code class="literal">
f()
</code>
itself is invoked within the context of
the
<code class="literal">
EXIT
</code>
handler, execution within
<code class="literal">
f()
</code>
has its own context, which is not
handler context. Thus,
<code class="literal">
RESIGNAL
</code>
within
<code class="literal">
f()
</code>
results in a
<span class="quote">
“
<span class="quote">
handler not
active
</span>
”
</span>
error.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-create-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-create-table">
</a>
15.7.7.11 SHOW CREATE TABLE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170875824">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa50319523"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em></code></pre>
</div>
<p>
Shows the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement
that creates the named table. To use this statement, you must
have some privilege for the table. This statement also works
with views.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98507675"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TABLE</span> t\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>
Table<span class="token punctuation">:</span> t
Create Table<span class="token punctuation">:</span> CREATE TABLE `t` (
`id` int NOT NULL AUTO_INCREMENT,
`s` char(60) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<a class="indexterm" name="idm46045170865040">
</a>
<p>
<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>
displays all
<code class="literal">
CHECK
</code>
constraints as table constraints. That
is, a
<code class="literal">
CHECK
</code>
constraint originally specified
as part of a column definition displays as a separate clause not
part of the column definition. Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41020097"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token punctuation">(</span>
i1 <span class="token datatype">INT</span> <span class="token keyword">CHECK</span> <span class="token punctuation">(</span>i1 <span class="token operator"><></span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token comment" spellcheck="true">-- column constraint</span>
i2 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">CHECK</span> <span class="token punctuation">(</span>i2 <span class="token operator">></span> i1<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token comment" spellcheck="true">-- table constraint</span>
<span class="token keyword">CHECK</span> <span class="token punctuation">(</span>i2 <span class="token operator"><></span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token keyword">ENFORCED</span> <span class="token comment" spellcheck="true">-- table constraint, not enforced</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1\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>
Table<span class="token punctuation">:</span> t1
Create Table<span class="token punctuation">:</span> CREATE TABLE `t1` (
`i1` int DEFAULT NULL,
`i2` int DEFAULT NULL,
CONSTRAINT `t1_chk_1` CHECK ((`i1` <> 0)),
CONSTRAINT `t1_chk_2` CHECK ((`i2` > `i1`)),
CONSTRAINT `t1_chk_3` CHECK ((`i2` <> 0)) /<span class="token punctuation">*</span>!80016 NOT ENFORCED <span class="token punctuation">*</span>/
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<p>
<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>
quotes table
and column names according to the value of the
<a class="link" href="server-system-variables.html#sysvar_sql_quote_show_create">
<code class="literal">
sql_quote_show_create
</code>
</a>
option.
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>
<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. For example, when changing the storage engine from
<code class="literal">
InnoDB
</code>
to
<code class="literal">
MyISAM
</code>
, options
specific to
<code class="literal">
InnoDB
</code>
, such as
<code class="literal">
ROW_FORMAT=COMPACT
</code>
, are retained, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2747722"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> 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">ROW_FORMAT</span><span class="token operator">=</span><span class="token keyword">COMPACT</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">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">ENGINE</span><span class="token operator">=</span>MyISAM<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1\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>
Table<span class="token punctuation">:</span> t1
Create Table<span class="token punctuation">:</span> CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT</span></code></pre>
</div>
<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 in response to
<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>
.
<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>
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>
<code class="literal">
SHOW CREATE TABLE
</code>
also includes the
definition of the table's generated invisible primary key,
if it has such a key, by default. You can cause this information
to be suppressed in the statement's output by setting
<a class="link" href="server-system-variables.html#sysvar_show_gipk_in_create_table_and_information_schema">
<code class="literal">
show_gipk_in_create_table_and_information_schema
= OFF
</code>
</a>
. For more information, see
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log-priority-based-filtering.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-log-priority-based-filtering">
</a>
7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
log_filter_internal
</code>
log filter component
implements a simple form of log filtering based on error event
priority and error code. To affect how
<code class="literal">
log_filter_internal
</code>
permits or suppresses
error, warning, and information events intended for the error
log, set the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
system variables.
</p>
<p>
<code class="literal">
log_filter_internal
</code>
is built in and enabled
by default. If this filter is disabled,
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
have
no effect, so filtering must be performed using another filter
service instead where desired (for example, with individual
filter rules when using
<code class="literal">
log_filter_dragnet
</code>
).
For information about filter configuration, see
<a class="xref" href="error-log-configuration.html" title="7.4.2.1 Error Log Configuration">
Section 7.4.2.1, “Error Log Configuration”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="error-log-priority-based-filtering.html#error-log-verbosity-filtering" title="Verbosity Filtering">
Verbosity Filtering
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-log-priority-based-filtering.html#error-log-suppression-filtering" title="Suppression-List Filtering">
Suppression-List Filtering
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-log-priority-based-filtering.html#error-log-verbosity-suppression-interaction" title="Verbosity and Suppression-List Interaction">
Verbosity and Suppression-List Interaction
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-verbosity-filtering">
</a>
Verbosity Filtering
</h5>
</div>
</div>
</div>
<p>
Events intended for the error log have a priority of
<code class="literal">
ERROR
</code>
,
<code class="literal">
WARNING
</code>
, or
<code class="literal">
INFORMATION
</code>
. The
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
system
variable controls verbosity based on which priorities to
permit for messages written to the log, as shown in the
following table.
</p>
<div class="informaltable">
<table summary="Permitted log_error_verbosity values and corresponding permitted message priorities.">
<colgroup>
<col style="width: 40%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th>
log_error_verbosity Value
</th>
<th>
Permitted Message Priorities
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
<code class="literal">
ERROR
</code>
</td>
</tr>
<tr>
<td>
2
</td>
<td>
<code class="literal">
ERROR
</code>
,
<code class="literal">
WARNING
</code>
</td>
</tr>
<tr>
<td>
3
</td>
<td>
<code class="literal">
ERROR
</code>
,
<code class="literal">
WARNING
</code>
,
<code class="literal">
INFORMATION
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
is 2
or greater, the server logs messages about statements that are
unsafe for statement-based logging. If the value is 3, the
server logs aborted connections and access-denied errors for
new connection attempts. See
<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>
.
</p>
<p>
If you use replication, a
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
value of
2 or greater is recommended, to obtain more information about
what is happening, such as messages about network failures and
reconnections.
</p>
<p>
If
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
is 2
or greater on a replica, the replica prints messages to the
error log to provide information about its status, such as the
binary log and relay log coordinates where it starts its job,
when it is switching to another relay log, when it reconnects
after a disconnect, and so forth.
</p>
<p>
There is also a message priority of
<code class="literal">
SYSTEM
</code>
that is not subject to verbosity filtering. System messages
about non-error situations are printed to the error log
regardless of the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
value.
These messages include startup and shutdown messages, and some
significant changes to settings.
</p>
<p>
In the MySQL error log, system messages are labeled as
<span class="quote">
“
<span class="quote">
System
</span>
”
</span>
. Other log sinks might or might not
follow the same convention, and in the resulting logs, system
messages might be assigned the label used for the information
priority level, such as
<span class="quote">
“
<span class="quote">
Note
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
Information
</span>
”
</span>
. If you apply any additional
filtering or redirection for logging based on the labeling of
messages, system messages do not override your filter, but are
handled by it in the same way as other messages.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-suppression-filtering">
</a>
Suppression-List Filtering
</h5>
</div>
</div>
</div>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
system variable applies to events intended for the error log
and specifies which events to suppress when they occur with a
priority of
<code class="literal">
WARNING
</code>
or
<code class="literal">
INFORMATION
</code>
. For example, if a particular
type of warning is considered undesirable
<span class="quote">
“
<span class="quote">
noise
</span>
”
</span>
in the error log because it occurs frequently but is not of
interest, it can be suppressed.
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
does not suppress messages with a priority of
<code class="literal">
ERROR
</code>
or
<code class="literal">
SYSTEM
</code>
.
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
value may be the empty string for no suppression, or a list of
one or more comma-separated values indicating the error codes
to suppress. Error codes may be specified in symbolic or
numeric form. A numeric code may be specified with or without
the
<code class="literal">
MY-
</code>
prefix. Leading zeros in the
numeric part are not significant. Examples of permitted code
formats:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa44298534"><div class="copy-help left">Press ⌘+C to 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">ER_SERVER_SHUTDOWN_COMPLETE
MY<span class="token operator">-</span>000031
000031
MY<span class="token operator">-</span>31
31</code></pre>
</div>
<p>
For readability and portability, symbolic values are
preferable to numeric values.
</p>
<p>
Although codes to be suppressed can be expressed in symbolic
or numeric form, the numeric value of each code must be in a
permitted range:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
1 to 999: Global error codes that are used by the server
as well as by clients.
</p>
</li>
<li class="listitem">
<p>
10000 and higher: Server error codes intended to be
written to the error log (not sent to clients).
</p>
</li>
</ul>
</div>
<p>
In addition, each error code specified must actually be used
by MySQL. Attempts to specify a code not within a permitted
range or within a permitted range but not used by MySQL
produce an error and the
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
value remains unchanged.
</p>
<p>
For information about error code ranges and the error symbols
and numbers defined within each range, see
<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>
, and
<a class="ulink" href="/doc/mysql-errors/8.4/en/" target="_top">
MySQL 8.4 Error Message Reference
</a>
.
</p>
<p>
The server can generate messages for a given error code at
differing priorities, so suppression of a message associated
with an error code listed in
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
depends on its priority. Suppose that the variable has a value
of
<code class="literal">
'ER_PARSER_TRACE,MY-010001,10002'
</code>
. Then
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
has these effects on messages for those codes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Messages generated with a priority of
<code class="literal">
WARNING
</code>
or
<code class="literal">
INFORMATION
</code>
are suppressed.
</p>
</li>
<li class="listitem">
<p>
Messages generated with a priority of
<code class="literal">
ERROR
</code>
or
<code class="literal">
SYSTEM
</code>
are
not suppressed.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-verbosity-suppression-interaction">
</a>
Verbosity and Suppression-List Interaction
</h5>
</div>
</div>
</div>
<p>
The effect of
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
combines
with that of
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
.
Consider a server started with these settings:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa87834400"><div class="copy-help left">Press ⌘+C to 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">log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>2 </span><span class="token comment" spellcheck="true"># error and warning messages only</span>
<span class="token constant">log_error_suppression_list</span><span class="token attr-value"><span class="token punctuation">=</span>'ER_PARSER_TRACE,MY-010001,10002'</span></code></pre>
</div>
<p>
In this case,
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
permits
messages with
<code class="literal">
ERROR
</code>
or
<code class="literal">
WARNING
</code>
priority and discards messages with
<code class="literal">
INFORMATION
</code>
priority. Of the nondiscarded
messages,
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
discards messages with
<code class="literal">
WARNING
</code>
priority and
any of the named error codes.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
value of 2 shown in the example is also its default value,
so the effect of this variable on
<code class="literal">
INFORMATION
</code>
messages is as just described
by default, without an explicit setting. You must set
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
to 3 if
you want
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
to affect messages with
<code class="literal">
INFORMATION
</code>
priority.
</p>
</div>
<p>
Consider a server started with this setting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95561164"><div class="copy-help left">Press ⌘+C to 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">log_error_verbosity</span><span class="token attr-value"><span class="token punctuation">=</span>1 </span><span class="token comment" spellcheck="true"># error messages only</span></code></pre>
</div>
<p>
In this case,
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
permits
messages with
<code class="literal">
ERROR
</code>
priority and discards
messages with
<code class="literal">
WARNING
</code>
or
<code class="literal">
INFORMATION
</code>
priority. Setting
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
has no effect because all error codes it might suppress are
already discarded due to the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
setting.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/datetime.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="datetime">
</a>
13.2.2 The DATE, DATETIME, and TIMESTAMP Types
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045213646144">
</a>
<a class="indexterm" name="idm46045213645104">
</a>
<a class="indexterm" name="idm46045213644032">
</a>
<a class="indexterm" name="idm46045213642960">
</a>
<a class="indexterm" name="idm46045213641472">
</a>
<a class="indexterm" name="idm46045213639984">
</a>
<p>
The
<code class="literal">
DATE
</code>
,
<code class="literal">
DATETIME
</code>
, and
<code class="literal">
TIMESTAMP
</code>
types are related. This section
describes their characteristics, how they are similar, and how
they differ. MySQL recognizes
<code class="literal">
DATE
</code>
,
<code class="literal">
DATETIME
</code>
, and
<code class="literal">
TIMESTAMP
</code>
values in several formats, described in
<a class="xref" href="date-and-time-literals.html" title="11.1.3 Date and Time Literals">
Section 11.1.3, “Date and Time Literals”
</a>
. For the
<code class="literal">
DATE
</code>
and
<code class="literal">
DATETIME
</code>
range
descriptions,
<span class="quote">
“
<span class="quote">
supported
</span>
”
</span>
means that although
earlier values might work, there is no guarantee.
</p>
<p>
The
<code class="literal">
DATE
</code>
type is used for values with a date
part but no time part. MySQL retrieves and displays
<code class="literal">
DATE
</code>
values in
<code class="literal">
'
<em class="replaceable">
<code>
YYYY-MM-DD
</code>
</em>
'
</code>
format. The supported range is
<code class="literal">
'1000-01-01'
</code>
to
<code class="literal">
'9999-12-31'
</code>
.
</p>
<p>
The
<code class="literal">
DATETIME
</code>
type is used for values that
contain both date and time parts. MySQL retrieves and displays
<code class="literal">
DATETIME
</code>
values in
<code class="literal">
'
<em class="replaceable">
<code>
YYYY-MM-DD
hh:mm:ss
</code>
</em>
'
</code>
format. The supported range is
<code class="literal">
'1000-01-01 00:00:00'
</code>
to
<code class="literal">
'9999-12-31
23:59:59'
</code>
.
</p>
<p>
The
<code class="literal">
TIMESTAMP
</code>
data type is used for values
that contain both date and time parts.
<code class="literal">
TIMESTAMP
</code>
has a range of
<code class="literal">
'1970-01-01
00:00:01'
</code>
UTC to
<code class="literal">
'2038-01-19
03:14:07'
</code>
UTC.
</p>
<p>
A
<code class="literal">
DATETIME
</code>
or
<code class="literal">
TIMESTAMP
</code>
value can include a trailing fractional seconds part in up to
microseconds (6 digits) precision. In particular, any fractional
part in a value inserted into a
<code class="literal">
DATETIME
</code>
or
<code class="literal">
TIMESTAMP
</code>
column is stored rather than
discarded. With the fractional part included, the format for
these values is
<code class="literal">
'
<em class="replaceable">
<code>
YYYY-MM-DD
hh:mm:ss
</code>
</em>
[.
<em class="replaceable">
<code>
fraction
</code>
</em>
]'
</code>
,
the range for
<code class="literal">
DATETIME
</code>
values is
<code class="literal">
'1000-01-01 00:00:00.000000'
</code>
to
<code class="literal">
'9999-12-31 23:59:59.499999'
</code>
, and the range
for
<code class="literal">
TIMESTAMP
</code>
values is
<code class="literal">
'1970-01-01
00:00:01.000000'
</code>
to
<code class="literal">
'2038-01-19
03:14:07.499999'
</code>
. The fractional part should always be
separated from the rest of the time by a decimal point; no other
fractional seconds delimiter is recognized. For information
about fractional seconds support in MySQL, 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>
<p>
The
<code class="literal">
TIMESTAMP
</code>
and
<code class="literal">
DATETIME
</code>
data types offer automatic initialization and updating to the
current date and time. For more information, see
<a class="xref" href="timestamp-initialization.html" title="13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME">
Section 13.2.5, “Automatic Initialization and Updating for TIMESTAMP and DATETIME”
</a>
.
</p>
<p>
MySQL converts
<code class="literal">
TIMESTAMP
</code>
values from the
current time zone to UTC for storage, and back from UTC to the
current time zone for retrieval. (This does not occur for other
types such as
<code class="literal">
DATETIME
</code>
.) By default, the
current time zone for each connection is the server's time. The
time zone can be set on a per-connection basis. As long as the
time zone setting remains constant, you get back the same value
you store. If you store a
<code class="literal">
TIMESTAMP
</code>
value,
and then change the time zone and retrieve the value, the
retrieved value is different from the value you stored. This
occurs because the same time zone was not used for conversion in
both directions. The current time zone is available as the value
of the
<a class="link" href="server-system-variables.html#sysvar_time_zone">
<code class="literal">
time_zone
</code>
</a>
system
variable. For more information, see
<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>
.
</p>
<p>
You can specify a time zone offset when inserting a
<code class="literal">
TIMESTAMP
</code>
or
<code class="literal">
DATETIME
</code>
value into a table. See
<a class="xref" href="date-and-time-literals.html" title="11.1.3 Date and Time Literals">
Section 11.1.3, “Date and Time Literals”
</a>
, for more information
and examples.
</p>
<p>
Invalid
<code class="literal">
DATE
</code>
,
<code class="literal">
DATETIME
</code>
, or
<code class="literal">
TIMESTAMP
</code>
values are converted to the
<span class="quote">
“
<span class="quote">
zero
</span>
”
</span>
value of the appropriate type
(
<code class="literal">
'0000-00-00'
</code>
or
<code class="literal">
'0000-00-00
00:00:00'
</code>
), if the SQL mode permits this conversion.
The precise behavior depends on which if any of strict SQL mode
and the
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
SQL mode
are enabled; see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
<p>
You can convert
<code class="literal">
TIMESTAMP
</code>
values to UTC
<code class="literal">
DATETIME
</code>
values when retrieving them using
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
with the
<code class="literal">
AT TIME
ZONE
</code>
operator, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94411735"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 punctuation">,</span>
<span class="token operator">></span> <span class="token function">CAST</span><span class="token punctuation">(</span>col <span class="token keyword">AT</span> <span class="token datatype">TIME</span> ZONE <span class="token keyword">INTERVAL</span> <span class="token string">'+00:00'</span> <span class="token keyword">AS</span> <span class="token datatype">DATETIME</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> ut
<span class="token operator">></span> <span class="token keyword">FROM</span> ts <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> 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>
<span class="token output"><span class="token punctuation">|</span> col <span class="token punctuation">|</span> ut <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 10:10:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 15:10:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2019<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 23:40:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 04:40:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 13:10:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 18:10:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 10:10:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 15:10:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 04:40:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 09:40:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 18:10:10 <span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 23:10:10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 complete information regarding syntax and additional
examples, see the description of the
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
function.
</p>
<a class="indexterm" name="idm46045213581760">
</a>
<a class="indexterm" name="idm46045213580272">
</a>
<p>
Be aware of certain properties of date value interpretation in
MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL permits a
<span class="quote">
“
<span class="quote">
relaxed
</span>
”
</span>
format for values
specified as strings, in which any punctuation character may
be used as the delimiter between date parts or time parts.
In some cases, this syntax can be deceiving. For example, a
value such as
<code class="literal">
'10:11:12'
</code>
might look like
a time value because of the
<code class="literal">
:
</code>
, but is
interpreted as the year
<code class="literal">
'2010-11-12'
</code>
if
used in date context. The value
<code class="literal">
'10:45:15'
</code>
is converted to
<code class="literal">
'0000-00-00'
</code>
because
<code class="literal">
'45'
</code>
is not a valid month.
</p>
<p>
The only delimiter recognized between a date and time part
and a fractional seconds part is the decimal point.
</p>
</li>
<li class="listitem">
<p>
The server requires that month and day values be valid, and
not merely in the range 1 to 12 and 1 to 31, respectively.
With strict mode disabled, invalid dates such as
<code class="literal">
'2004-04-31'
</code>
are converted to
<code class="literal">
'0000-00-00'
</code>
and a warning is generated.
With strict mode enabled, invalid dates generate an error.
To permit such dates, enable
<a class="link" href="sql-mode.html#sqlmode_allow_invalid_dates">
<code class="literal">
ALLOW_INVALID_DATES
</code>
</a>
. See
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
, for more information.
</p>
</li>
<li class="listitem">
<p>
MySQL does not accept
<code class="literal">
TIMESTAMP
</code>
values
that include a zero in the day or month column or values
that are not a valid date. The sole exception to this rule
is the special
<span class="quote">
“
<span class="quote">
zero
</span>
”
</span>
value
<code class="literal">
'0000-00-00 00:00:00'
</code>
, if the SQL mode
permits this value. The precise behavior depends on which if
any of strict SQL mode and the
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
SQL mode are
enabled; see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Dates containing 2-digit year values are ambiguous because
the century is unknown. MySQL interprets 2-digit year values
using these rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Year values in the range
<code class="literal">
00-69
</code>
become
<code class="literal">
2000-2069
</code>
.
</p>
</li>
<li class="listitem">
<p>
Year values in the range
<code class="literal">
70-99
</code>
become
<code class="literal">
1970-1999
</code>
.
</p>
</li>
</ul>
</div>
<p>
See also
<a class="xref" href="two-digit-years.html" title="13.2.9 2-Digit Years in Dates">
Section 13.2.9, “2-Digit Years in Dates”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/audit-log.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="audit-log">
</a>
8.4.5 MySQL Enterprise Audit
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="audit-log-elements.html">
8.4.5.1 Elements of MySQL Enterprise Audit
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-installation.html">
8.4.5.2 Installing or Uninstalling MySQL Enterprise Audit
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-security.html">
8.4.5.3 MySQL Enterprise Audit Security Considerations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-file-formats.html">
8.4.5.4 Audit Log File Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-logging-configuration.html">
8.4.5.5 Configuring Audit Logging Characteristics
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-file-reading.html">
8.4.5.6 Reading Audit Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-filtering.html">
8.4.5.7 Audit Log Filtering
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-filter-definitions.html">
8.4.5.8 Writing Audit Log Filter Definitions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-disabling.html">
8.4.5.9 Disabling Audit Logging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-legacy-filtering.html">
8.4.5.10 Legacy Mode Audit Log Filtering
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-reference.html">
8.4.5.11 Audit Log Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log-restrictions.html">
8.4.5.12 Audit Log Restrictions
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045238633344">
</a>
<a class="indexterm" name="idm46045238632272">
</a>
<a class="indexterm" name="idm46045238630784">
</a>
<a class="indexterm" name="idm46045238629712">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL Enterprise Audit 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>
MySQL Enterprise Edition includes MySQL Enterprise Audit, implemented using a server plugin named
<code class="literal">
audit_log
</code>
. MySQL Enterprise Audit uses the open MySQL Audit
API to enable standard, policy-based monitoring, logging, and
blocking of connection and query activity executed on specific
MySQL servers. Designed to meet the Oracle audit specification,
MySQL Enterprise Audit provides an out of box, easy to use auditing and
compliance solution for applications that are governed by both
internal and external regulatory guidelines.
</p>
<p>
When installed, the audit plugin enables MySQL Server to produce a
log file containing an audit record of server activity. The log
contents include when clients connect and disconnect, and what
actions they perform while connected, such as which databases and
tables they access. You can add statistics for the time and size
of each query to detect outliers.
</p>
<p>
By default, MySQL Enterprise Audit uses tables in the
<code class="literal">
mysql
</code>
system database for persistent storage of filter and user account
data. To use a different database, set the
<a class="link" href="audit-log-reference.html#sysvar_audit_log_database">
<code class="literal">
audit_log_database
</code>
</a>
system
variable at server startup.
</p>
<p>
After you install the audit plugin (see
<a class="xref" href="audit-log-installation.html" title="8.4.5.2 Installing or Uninstalling MySQL Enterprise Audit">
Section 8.4.5.2, “Installing or Uninstalling MySQL Enterprise Audit”
</a>
), it writes an audit log
file. By default, the file is named
<code class="filename">
audit.log
</code>
in the server data directory. To change the name of the file, set
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.
</p>
<p>
By default, audit log file contents are written in new-style XML
format, without compression or encryption. To select the file
format, set the
<a class="link" href="audit-log-reference.html#sysvar_audit_log_format">
<code class="literal">
audit_log_format
</code>
</a>
system variable at server startup. For details on file format and
contents, see
<a class="xref" href="audit-log-file-formats.html" title="8.4.5.4 Audit Log File Formats">
Section 8.4.5.4, “Audit Log File Formats”
</a>
.
</p>
<p>
For more information about controlling how logging occurs,
including audit log file naming and format selection, see
<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>
. To perform
filtering of audited events, see
<a class="xref" href="audit-log-filtering.html" title="8.4.5.7 Audit Log Filtering">
Section 8.4.5.7, “Audit Log Filtering”
</a>
. For descriptions of the
parameters used to configure the audit log plugin, see
<a class="xref" href="audit-log-reference.html#audit-log-options-variables" title="Audit Log Options and Variables">
Audit Log Options and Variables
</a>
.
</p>
<p>
If the audit log plugin is enabled, the Performance Schema (see
<a class="xref" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Chapter 29,
<i>
MySQL Performance Schema
</i>
</a>
) has instrumentation for it.
To identify the relevant instruments, use this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24119707"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%/alog/%'</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/security-plugins.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="security-plugins">
</a>
8.4 Security Components and Plugins
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="authentication-plugins.html">
8.4.1 Authentication Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-control.html">
8.4.2 The Connection-Control Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="validate-password.html">
8.4.3 The Password Validation Component
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="keyring.html">
8.4.4 The MySQL Keyring
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log.html">
8.4.5 MySQL Enterprise Audit
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-api-message-emit.html">
8.4.6 The Audit Message Component
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="firewall.html">
8.4.7 MySQL Enterprise Firewall
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045246380208">
</a>
<a class="indexterm" name="idm46045246378752">
</a>
<a class="indexterm" name="idm46045246377264">
</a>
<a class="indexterm" name="idm46045246375776">
</a>
<p>
MySQL includes several components and plugins that implement
security features:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Plugins for authenticating attempts by clients to connect to
MySQL Server. Plugins are available for several authentication
protocols. For general discussion of the authentication process,
see
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
. For
characteristics of specific authentication plugins, see
<a class="xref" href="authentication-plugins.html" title="8.4.1 Authentication Plugins">
Section 8.4.1, “Authentication Plugins”
</a>
.
</p>
</li>
<li class="listitem">
<p>
A password-validation component for implementing password
strength policies and assessing the strength of potential
passwords. See
<a class="xref" href="validate-password.html" title="8.4.3 The Password Validation Component">
Section 8.4.3, “The Password Validation Component”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Keyring plugins that provide secure storage for sensitive
information. See
<a class="xref" href="keyring.html" title="8.4.4 The MySQL Keyring">
Section 8.4.4, “The MySQL Keyring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
(MySQL Enterprise Edition only) MySQL Enterprise Audit, implemented using a server plugin, uses
the open MySQL Audit API to enable standard, policy-based
monitoring and logging of connection and query activity executed
on specific MySQL servers. Designed to meet the Oracle audit
specification, MySQL Enterprise Audit provides an out of box, easy to use
auditing and compliance solution for applications that are
governed by both internal and external regulatory guidelines.
See
<a class="xref" href="audit-log.html" title="8.4.5 MySQL Enterprise Audit">
Section 8.4.5, “MySQL Enterprise Audit”
</a>
.
</p>
</li>
<li class="listitem">
<p>
A function enables applications to add their own message events
to the audit log. See
<a class="xref" href="audit-api-message-emit.html" title="8.4.6 The Audit Message Component">
Section 8.4.6, “The Audit Message Component”
</a>
.
</p>
</li>
<li class="listitem">
<p>
(MySQL Enterprise Edition only) MySQL Enterprise Firewall, an application-level firewall that enables
database administrators to permit or deny SQL statement
execution based on matching against lists of accepted statement
patterns. This helps harden MySQL Server against attacks such as
SQL injection or attempts to exploit applications by using them
outside of their legitimate query workload characteristics. See
<a class="xref" href="firewall.html" title="8.4.7 MySQL Enterprise Firewall">
Section 8.4.7, “MySQL Enterprise Firewall”
</a>
.
</p>
</li>
<li class="listitem">
<p>
(MySQL Enterprise Edition only) MySQL Enterprise Data Masking and De-Identification, implemented as a plugin library
containing a plugin and a set of functions. Data masking hides
sensitive information by replacing real values with substitutes.
MySQL Enterprise Data Masking and De-Identification functions enable masking existing data using several
methods such as obfuscation (removing identifying
characteristics), generation of formatted random data, and data
replacement or substitution. See
<a class="xref" href="data-masking.html" title="8.5 MySQL Enterprise Data Masking and De-Identification">
Section 8.5, “MySQL Enterprise Data Masking and De-Identification”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/cannot-find-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="cannot-find-table">
</a>
B.3.2.14 Table 'tbl_name' doesn't exist
</h4>
</div>
</div>
</div>
<p>
If you get either of the following errors, it usually means
that no table exists in the default database with the given
name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa73370509"><div class="copy-help left">Press ⌘+C to 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">Table '<em class="replaceable">tbl_name</em>' doesn't exist
Can't find file: '<em class="replaceable">tbl_name</em>' (errno: 2)</code></pre>
</div>
<p>
In some cases, it may be that the table does exist but that
you are referring to it incorrectly:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Because MySQL uses directories and files to store
databases and tables, database and table names are
case-sensitive if they are located on a file system that
has case-sensitive file names.
</p>
</li>
<li class="listitem">
<p>
Even for file systems that are not case-sensitive, such as
on Windows, all references to a given table within a query
must use the same lettercase.
</p>
</li>
</ul>
</div>
<p>
You can check which tables are in the default database with
<a class="link" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
<code class="literal">
SHOW TABLES
</code>
</a>
. See
<a class="xref" href="show.html" title="15.7.7 SHOW Statements">
Section 15.7.7, “SHOW Statements”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-thread-pool-table-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-thread-pool-table-reference">
</a>
28.5.1 INFORMATION_SCHEMA Thread Pool Table Reference
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076081472">
</a>
<a class="indexterm" name="idm46045076079968">
</a>
<p>
The following table summarizes
<code class="literal">
INFORMATION_SCHEMA
</code>
thread pool tables. For
greater detail, see the individual table descriptions.
</p>
<div class="table">
<a name="idm46045076077216">
</a>
<p class="title">
<b>
Table 28.7 INFORMATION_SCHEMA Thread Pool Tables
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists INFORMATION_SCHEMA thread pool tables.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Table Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="information-schema-tp-thread-group-state-table.html" title="28.5.2 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATE Table">
<code class="literal">
TP_THREAD_GROUP_STATE
</code>
</a>
</td>
<td>
Thread pool thread group states
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-tp-thread-group-stats-table.html" title="28.5.3 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATS Table">
<code class="literal">
TP_THREAD_GROUP_STATS
</code>
</a>
</td>
<td>
Thread pool thread group statistics
</td>
</tr>
<tr>
<td>
<a class="link" href="information-schema-tp-thread-state-table.html" title="28.5.4 The INFORMATION_SCHEMA TP_THREAD_STATE Table">
<code class="literal">
TP_THREAD_STATE
</code>
</a>
</td>
<td>
Thread pool thread information
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connecting-using-dns-srv.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="connecting-using-dns-srv">
</a>
6.2.6 Connecting to the Server Using DNS SRV Records
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045322411936">
</a>
<a class="indexterm" name="idm46045322410864">
</a>
<p>
In the Domain Name System (DNS), a SRV record (service location
record) is a type of resource record that enables a client to
specify a name that indicates a service, protocol, and domain. A
DNS lookup on the name returns a reply containing the names of
multiple available servers in the domain that provide the required
service. For information about DNS SRV, including how a record
defines the preference order of the listed servers, see
<a class="ulink" href="https://tools.ietf.org/html/rfc2782" target="_blank">
RFC 2782
</a>
.
</p>
<p>
MySQL supports the use of DNS SRV records for connecting to
servers. A client that receives a DNS SRV lookup result attempts
to connect to the MySQL server on each of the listed hosts in
order of preference, based on the priority and weighting assigned
to each host by the DNS administrator. A failure to connect occurs
only if the client cannot connect to any of the servers.
</p>
<p>
When multiple MySQL instances, such as a cluster of servers,
provide the same service for your applications, DNS SRV records
can be used to assist with failover, load balancing, and
replication services. It is cumbersome for applications to
directly manage the set of candidate servers for connection
attempts, and DNS SRV records provide an alternative:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
DNS SRV records enable a DNS administrator to map a single DNS
domain to multiple servers. DNS SRV records also can be
updated centrally by administrators when servers are added or
removed from the configuration or when their host names are
changed.
</p>
</li>
<li class="listitem">
<p>
Central management of DNS SRV records eliminates the need for
individual clients to identify each possible host in
connection requests, or for connections to be handled by an
additional software component. An application can use the DNS
SRV record to obtain information about candidate MySQL
servers, instead of managing the server information itself.
</p>
</li>
<li class="listitem">
<p>
DNS SRV records can be used in combination with connection
pooling, in which case connections to hosts that are no longer
in the current list of DNS SRV records are removed from the
pool when they become idle.
</p>
</li>
</ul>
</div>
<p>
MySQL supports use of DNS SRV records to connect to servers in
these contexts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Several MySQL Connectors implement DNS SRV support;
connector-specific options enable requesting DNS SRV record
lookup both for X Protocol connections and for
classic MySQL protocol connections. For general information, see
<a class="ulink" href="/doc/x-devapi-userguide/en/connecting-dns-srv.html" target="_top">
Connections Using DNS SRV Records
</a>
. For details, see the
documentation for individual MySQL Connectors.
</p>
</li>
<li class="listitem">
<p>
The C API provides a
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect-dns-srv.html" target="_top">
<code class="literal">
mysql_real_connect_dns_srv()
</code>
</a>
function that is similar to
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect.html" target="_top">
<code class="literal">
mysql_real_connect()
</code>
</a>
, except
that the argument list does not specify the particular host of
the MySQL server to connect to. Instead, it names a DNS SRV
record that specifies a group of servers. See
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect-dns-srv.html" target="_top">
mysql_real_connect_dns_srv()
</a>
.
</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>
client has a
<a class="link" href="mysql-command-options.html#option_mysql_dns-srv-name">
<code class="option">
--dns-srv-name
</code>
</a>
option to
indicate a DNS SRV record that specifies a group of servers.
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>
<p>
A DNS SRV name consists of a service, protocol, and domain, with
the service and protocol each prefixed by an underscore:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa3058022"><div class="copy-help left">Press ⌘+C to 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">_<em class="replaceable">service</em><span class="token punctuation">.</span>_<em class="replaceable">protocol</em><span class="token punctuation">.</span><em class="replaceable">domain</em></code></pre>
</div>
<p>
The following DNS SRV record identifies multiple candidate
servers, such as might be used by clients for establishing
X Protocol connections:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa84951181"><div class="copy-help left">Press ⌘+C to 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">Name TTL Class Priority Weight Port Target
_mysqlx<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 0 5 33060 server1<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysqlx<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 0 10 33060 server2<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysqlx<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 10 5 33060 server3<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysqlx<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 20 5 33060 server4<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span></code></pre>
</div>
<p>
Here,
<code class="literal">
mysqlx
</code>
indicates the X Protocol service
and
<code class="literal">
tcp
</code>
indicates the TCP protocol. A client
can request this DNS SRV record using the name
<code class="literal">
_mysqlx._tcp.example.com
</code>
. The particular syntax
for specifying the name in the connection request depends on the
type of client. For example, a client might support specifying the
name within a URI-like connection string or as a key-value pair.
</p>
<p>
A DNS SRV record for classic protocol connections might look like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa16059411"><div class="copy-help left">Press ⌘+C to 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">Name TTL Class Priority Weight Port Target
_mysql<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 0 5 3306 server1<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysql<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 0 10 3306 server2<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysql<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 10 5 3306 server3<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span>
_mysql<span class="token punctuation">.</span>_tcp<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span> 86400 IN SRV 20 5 3306 server4<span class="token punctuation">.</span>example<span class="token punctuation">.</span>com<span class="token punctuation">.</span></code></pre>
</div>
<p>
Here, the name
<code class="literal">
mysql
</code>
designates the
classic MySQL protocol service, and the port is 3306 (the default
classic MySQL protocol port) rather than 33060 (the default X Protocol
port).
</p>
<p>
When DNS SRV record lookup is used, clients generally must apply
these rules for connection requests (there may be client- or
connector-specific exceptions):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The request must specify the full DNS SRV record name, with
the service and protocol names prefixed by underscores.
</p>
</li>
<li class="listitem">
<p>
The request must not specify multiple host names.
</p>
</li>
<li class="listitem">
<p>
The request must not specify a port number.
</p>
</li>
<li class="listitem">
<p>
Only TCP connections are supported. Unix socket files, Windows
named pipes, and shared memory cannot be used.
</p>
</li>
</ul>
</div>
<p>
For more information on using DNS SRV based connections in
X DevAPI, see
<a class="ulink" href="/doc/x-devapi-userguide/en/connecting-dns-srv.html" target="_top">
Connections Using DNS SRV Records
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-data-formats.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="gis-data-formats">
</a>
13.4.3 Supported Spatial Data Formats
</h3>
</div>
</div>
</div>
<p>
Two standard spatial data formats are used to represent geometry
objects in queries:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Well-Known Text (WKT) format
</p>
</li>
<li class="listitem">
<p>
Well-Known Binary (WKB) format
</p>
</li>
</ul>
</div>
<p>
Internally, MySQL stores geometry values in a format that is not
identical to either WKT or WKB format. (Internal format is like
WKB but with an initial 4 bytes to indicate the SRID.)
</p>
<p>
There are functions available to convert between different data
formats; see
<a class="xref" href="gis-format-conversion-functions.html" title="14.16.6 Geometry Format Conversion Functions">
Section 14.16.6, “Geometry Format Conversion Functions”
</a>
.
</p>
<p>
The following sections describe the spatial data formats MySQL
uses:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="gis-data-formats.html#gis-wkt-format" title="Well-Known Text (WKT) Format">
Well-Known Text (WKT) Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="gis-data-formats.html#gis-wkb-format" title="Well-Known Binary (WKB) Format">
Well-Known Binary (WKB) Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="gis-data-formats.html#gis-internal-format" title="Internal Geometry Storage Format">
Internal Geometry Storage Format
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="gis-wkt-format">
</a>
Well-Known Text (WKT) Format
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045211804688">
</a>
<a class="indexterm" name="idm46045211803232">
</a>
<a class="indexterm" name="idm46045211801744">
</a>
<p>
The Well-Known Text (WKT) representation of geometry values is
designed for exchanging geometry data in ASCII form. The
OpenGIS specification provides a Backus-Naur grammar that
specifies the formal production rules for writing WKT values
(see
<a class="xref" href="spatial-types.html" title="13.4 Spatial Data Types">
Section 13.4, “Spatial Data Types”
</a>
).
</p>
<p>
Examples of WKT representations of geometry objects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
Point
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa91433989"><div class="copy-help left">Press ⌘+C to 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">POINT<span class="token punctuation">(</span>15 20<span class="token punctuation">)</span></code></pre>
</div>
<p>
The point coordinates are specified with no separating
comma. This differs from the syntax for the SQL
<a class="link" href="gis-mysql-specific-functions.html#function_point">
<code class="literal">
Point()
</code>
</a>
function, which
requires a comma between the coordinates. Take care to use
the syntax appropriate to the context of a given spatial
operation. For example, the following statements both use
<a class="link" href="gis-point-property-functions.html#function_st-x">
<code class="literal">
ST_X()
</code>
</a>
to extract the
X-coordinate from a
<code class="literal">
Point
</code>
object. The
first produces the object directly using the
<a class="link" href="gis-mysql-specific-functions.html#function_point">
<code class="literal">
Point()
</code>
</a>
function. The
second uses a WKT representation converted to a
<code class="literal">
Point
</code>
with
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95943409"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_X</span><span class="token punctuation">(</span><span class="token function">Point</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">,</span> <span class="token number">20</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>
<span class="token output"><span class="token punctuation">|</span> ST_X(POINT(15, 20)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">ST_X</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(15 20)'</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> ST_X(ST_GeomFromText('POINT(15 20)')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
A
<code class="literal">
LineString
</code>
with four points:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa74879070"><div class="copy-help left">Press ⌘+C to 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">LINESTRING<span class="token punctuation">(</span>0 0<span class="token punctuation">,</span> 10 10<span class="token punctuation">,</span> 20 25<span class="token punctuation">,</span> 50 60<span class="token punctuation">)</span></code></pre>
</div>
<p>
The point coordinate pairs are separated by commas.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
Polygon
</code>
with one exterior ring and
one interior ring:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa81450685"><div class="copy-help left">Press ⌘+C to 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">POLYGON<span class="token punctuation">(</span><span class="token punctuation">(</span>0 0<span class="token punctuation">,</span>10 0<span class="token punctuation">,</span>10 10<span class="token punctuation">,</span>0 10<span class="token punctuation">,</span>0 0<span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span>5 5<span class="token punctuation">,</span>7 5<span class="token punctuation">,</span>7 7<span class="token punctuation">,</span>5 7<span class="token punctuation">,</span> 5 5<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPoint
</code>
with three
<code class="literal">
Point
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa88993890"><div class="copy-help left">Press ⌘+C to 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">MULTIPOINT<span class="token punctuation">(</span>0 0<span class="token punctuation">,</span> 20 20<span class="token punctuation">,</span> 60 60<span class="token punctuation">)</span></code></pre>
</div>
<p>
Spatial functions such as
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MPointFromText()
</code>
</a>
and
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
</a>
that
accept WKT-format representations of
<code class="literal">
MultiPoint
</code>
values permit individual
points within values to be surrounded by parentheses. For
example, both of the following function calls are valid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30257756"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_MPointFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT (1 1, 2 2, 3 3)'</span><span class="token punctuation">)</span>
<span class="token function">ST_MPointFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT ((1 1), (2 2), (3 3))'</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiLineString
</code>
with two
<code class="literal">
LineString
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa2995786"><div class="copy-help left">Press ⌘+C to 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">MULTILINESTRING<span class="token punctuation">(</span><span class="token punctuation">(</span>10 10<span class="token punctuation">,</span> 20 20<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>15 15<span class="token punctuation">,</span> 30 15<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
with two
<code class="literal">
Polygon
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa49918059"><div class="copy-help left">Press ⌘+C to 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">MULTIPOLYGON<span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">(</span>0 0<span class="token punctuation">,</span>10 0<span class="token punctuation">,</span>10 10<span class="token punctuation">,</span>0 10<span class="token punctuation">,</span>0 0<span 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 5<span class="token punctuation">,</span>7 5<span class="token punctuation">,</span>7 7<span class="token punctuation">,</span>5 7<span class="token punctuation">,</span> 5 5<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A
<code class="literal">
GeometryCollection
</code>
consisting of two
<code class="literal">
Point
</code>
values and one
<code class="literal">
LineString
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa44434513"><div class="copy-help left">Press ⌘+C to 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">GEOMETRYCOLLECTION<span class="token punctuation">(</span>POINT<span class="token punctuation">(</span>10 10<span class="token punctuation">)</span><span class="token punctuation">,</span> POINT<span class="token punctuation">(</span>30 30<span class="token punctuation">)</span><span class="token punctuation">,</span> LINESTRING<span class="token punctuation">(</span>15 15<span class="token punctuation">,</span> 20 20<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="gis-wkb-format">
</a>
Well-Known Binary (WKB) Format
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045211756336">
</a>
<a class="indexterm" name="idm46045211754880">
</a>
<a class="indexterm" name="idm46045211753376">
</a>
<p>
The Well-Known Binary (WKB) representation of geometric values
is used for exchanging geometry data as binary streams
represented by
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
values
containing geometric WKB information. This format is defined
by the OpenGIS specification (see
<a class="xref" href="spatial-types.html" title="13.4 Spatial Data Types">
Section 13.4, “Spatial Data Types”
</a>
). It is also defined in the
ISO
<em class="citetitle">
SQL/MM Part 3: Spatial
</em>
standard.
</p>
<p>
WKB uses 1-byte unsigned integers, 4-byte unsigned integers,
and 8-byte double-precision numbers (IEEE 754 format). A byte
is eight bits.
</p>
<p>
For example, a WKB value that corresponds to
<code class="literal">
POINT(1
-1)
</code>
consists of this sequence of 21 bytes, each
represented by two hexadecimal digits:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa77405367"><div class="copy-help left">Press ⌘+C to 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">0101000000000000000000F03F000000000000F0BF</code></pre>
</div>
<p>
The sequence consists of the components shown in the following
table.
</p>
<div class="table">
<a name="wkb-components-example-table">
</a>
<p class="title">
<b>
Table 13.2 WKB Components Example
</b>
</p>
<div class="table-contents">
<table summary="Example showing component in WKB values.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 30%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Component
</th>
<th scope="col">
Size
</th>
<th scope="col">
Value
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Byte order
</th>
<td>
1 byte
</td>
<td>
<code class="literal">
01
</code>
</td>
</tr>
<tr>
<th scope="row">
WKB type
</th>
<td>
4 bytes
</td>
<td>
<code class="literal">
01000000
</code>
</td>
</tr>
<tr>
<th scope="row">
X coordinate
</th>
<td>
8 bytes
</td>
<td>
<code class="literal">
000000000000F03F
</code>
</td>
</tr>
<tr>
<th scope="row">
Y coordinate
</th>
<td>
8 bytes
</td>
<td>
<code class="literal">
000000000000F0BF
</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Component representation is as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The byte order indicator is either 1 or 0 to signify
little-endian or big-endian storage. The little-endian and
big-endian byte orders are also known as Network Data
Representation (NDR) and External Data Representation
(XDR), respectively.
</p>
</li>
<li class="listitem">
<p>
The WKB type is a code that indicates the geometry type.
MySQL uses values from 1 through 7 to indicate
<code class="literal">
Point
</code>
,
<code class="literal">
LineString
</code>
,
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
MultiLineString
</code>
,
<code class="literal">
MultiPolygon
</code>
, and
<code class="literal">
GeometryCollection
</code>
.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
Point
</code>
value has X and Y coordinates,
each represented as a double-precision value.
</p>
</li>
</ul>
</div>
<p>
WKB values for more complex geometry values have more complex
data structures, as detailed in the OpenGIS specification.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="gis-internal-format">
</a>
Internal Geometry Storage Format
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045211710928">
</a>
<a class="indexterm" name="idm46045211709472">
</a>
<p>
MySQL stores geometry values using 4 bytes to indicate the
SRID followed by the WKB representation of the value. For a
description of WKB format, see
<a class="xref" href="gis-data-formats.html#gis-wkb-format" title="Well-Known Binary (WKB) Format">
Well-Known Binary (WKB) Format
</a>
.
</p>
<p>
For the WKB part, these MySQL-specific considerations apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The byte-order indicator byte is 1 because MySQL stores
geometries as little-endian values.
</p>
</li>
<li class="listitem">
<p>
MySQL supports geometry types of
<code class="literal">
Point
</code>
,
<code class="literal">
LineString
</code>
,
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
MultiLineString
</code>
,
<code class="literal">
MultiPolygon
</code>
, and
<code class="literal">
GeometryCollection
</code>
. Other geometry
types are not supported.
</p>
</li>
<li class="listitem">
<p>
Only
<code class="literal">
GeometryCollection
</code>
can be empty.
Such a value is stored with 0 elements.
</p>
</li>
<li class="listitem">
<p>
Polygon rings can be specified both clockwise and
counterclockwise. MySQL flips the rings automatically when
reading data.
</p>
</li>
</ul>
</div>
<p>
Cartesian coordinates are stored in the length unit of the
spatial reference system, with X values in the X coordinates
and Y values in the Y coordinates. Axis directions are those
specified by the spatial reference system.
</p>
<p>
Geographic coordinates are stored in the angle unit of the
spatial reference system, with longitudes in the X coordinates
and latitudes in the Y coordinates. Axis directions and the
meridian are those specified by the spatial reference system.
</p>
<p>
The
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
function returns
the space in bytes required for value storage. Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67219867"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@g</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(1 -1)'</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">LENGTH</span><span class="token punctuation">(</span><span class="token variable">@g</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>
<span class="token output"><span class="token punctuation">|</span> LENGTH(@g) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 25 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">@g</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>
<span class="token output"><span class="token punctuation">|</span> HEX(@g) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 000000000101000000000000000000F03F000000000000F0BF <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 value length is 25 bytes, made up of these components (as
can be seen from the hexadecimal value):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
4 bytes for integer SRID (0)
</p>
</li>
<li class="listitem">
<p>
1 byte for integer byte order (1 = little-endian)
</p>
</li>
<li class="listitem">
<p>
4 bytes for integer type information (1 =
<code class="literal">
Point
</code>
)
</p>
</li>
<li class="listitem">
<p>
8 bytes for double-precision X coordinate (1)
</p>
</li>
<li class="listitem">
<p>
8 bytes for double-precision Y coordinate (−1)
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-auto-positioning.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-gtids-auto-positioning">
</a>
19.1.3.3 GTID Auto-Positioning
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146091600">
</a>
<p>
GTIDs replace the file-offset pairs previously required to
determine points for starting, stopping, or resuming the flow of
data between source and replica. When GTIDs are in use, all the
information that the replica needs for synchronizing with the
source is obtained directly from the replication data stream.
</p>
<p>
To start a replica using GTID-based replication, you need to
enable the
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option in 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. The alternative
<code class="literal">
SOURCE_LOG_FILE
</code>
and
<code class="literal">
SOURCE_LOG_POS
</code>
options specify the name of the
log file and the starting position within the file, but with GTIDs
the replica does not need this nonlocal data. For full
instructions to configure and start sources and replicas using
GTID-based replication, see
<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>
.
</p>
<p>
The
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option is disabled by
default. If multi-source replication is enabled on the replica,
you need to set the option for each applicable replication
channel. Disabling the
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option again causes the replica to revert to file-based
replication; this means that, when
<code class="literal">
GTID_ONLY=ON
</code>
, some positions may be marked as
invalid, in which case you must also specify both
<code class="literal">
SOURCE_LOG_FILE
</code>
and
<code class="literal">
SOURCE_LOG_POS
</code>
when disabling
<code class="literal">
SOURCE_AUTO_POSITION
</code>
.
</p>
<p>
When a replica has GTIDs enabled
(
<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>
) and the
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option enabled,
auto-positioning is activated for connection to the source. The
source must have
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
GTID_MODE=ON
</code>
</a>
set
in order for the connection to succeed. In the initial handshake,
the replica sends a GTID set containing the transactions that it
has already received, committed, or both. This GTID set is equal
to the union of the set of GTIDs in the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
system variable
(
<code class="literal">
@@GLOBAL.gtid_executed
</code>
), and the set of GTIDs
recorded in the Performance Schema
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
table
as received transactions (the result of the statement
<code class="literal">
SELECT RECEIVED_TRANSACTION_SET FROM
PERFORMANCE_SCHEMA.replication_connection_status
</code>
).
</p>
<p>
The source responds by sending all transactions recorded in its
binary log whose GTID is not included in the GTID set sent by the
replica. To do this, the source first identifies the appropriate
binary log file to begin working with, by checking the
<code class="literal">
Previous_gtids_log_event
</code>
in the header of each
of its binary log files, starting with the most recent. When the
source finds the first
<code class="literal">
Previous_gtids_log_event
</code>
which contains no transactions that the replica is missing, it
begins with that binary log file. This method is efficient and
only takes a significant amount of time if the replica is behind
the source by a large number of binary log files. The source then
reads the transactions in that binary log file and subsequent
files up to the current one, sending the transactions with GTIDs
that the replica is missing, and skipping the transactions that
were in the GTID set sent by the replica. The elapsed time until
the replica receives the first missing transaction depends on its
offset in the binary log file. This exchange ensures that the
source only sends the transactions with a GTID that the replica
has not already received or committed. If the replica receives
transactions from more than one source, as in the case of a
diamond topology, the auto-skip function ensures that the
transactions are not applied twice.
</p>
<p>
If any of the transactions that should be sent by the source have
been purged from the source's binary log, or added to the set
of GTIDs in the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_purged">
<code class="literal">
gtid_purged
</code>
</a>
system variable by another method, the source sends the error
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_source_has_purged_required_gtids" target="_top">
<code class="literal">
ER_SOURCE_HAS_PURGED_REQUIRED_GTIDS
</code>
</a>
to the replica, and replication does not start. The GTIDs of the
missing purged transactions are identified and listed in the
source's error log in the warning message
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_found_missing_gtids" target="_top">
<code class="literal">
ER_FOUND_MISSING_GTIDS
</code>
</a>
. The
replica cannot recover automatically from this error because parts
of the transaction history that are needed to catch up with the
source have been purged. Attempting to reconnect without the
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option enabled only
results in the loss of the purged transactions on the replica. The
correct approach to recover from this situation is for the replica
to replicate the missing transactions listed in the
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_found_missing_gtids" target="_top">
<code class="literal">
ER_FOUND_MISSING_GTIDS
</code>
</a>
message
from another source, or for the replica to be replaced by a new
replica created from a more recent backup. Consider revising the
binary log expiration period
(
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds">
<code class="literal">
binlog_expire_logs_seconds
</code>
</a>
) on
the source to ensure that the situation does not occur again.
</p>
<p>
If during the exchange of transactions it is found that the
replica has received or committed transactions with the
source's UUID in the GTID, but the source itself does not
have a record of them, the source sends the error
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_replica_has_more_gtids_than_source" target="_top">
<code class="literal">
ER_REPLICA_HAS_MORE_GTIDS_THAN_SOURCE
</code>
</a>
to the replica and replication does not start. This situation can
occur if a source that does not have
<a class="link" href="replication-options-binary-log.html#sysvar_sync_binlog">
<code class="literal">
sync_binlog=1
</code>
</a>
set experiences a
power failure or operating system crash, and loses committed
transactions that have not yet been synchronized to the binary log
file, but have been received by the replica. The source and
replica can diverge if any clients commit transactions on the
source after it is restarted, which can lead to the situation
where the source and replica are using the same GTID for different
transactions. The correct approach to recover from this situation
is to check manually whether the source and replica have diverged.
If the same GTID is now in use for different transactions, you
either need to perform manual conflict resolution for individual
transactions as required, or remove either the source or the
replica from the replication topology. If the issue is only
missing transactions on the source, you can make the source into a
replica instead, allow it to catch up with the other servers in
the replication topology, and then make it a source again if
needed.
</p>
<p>
For a multi-source replica in a diamond topology (where the
replica replicates from two or more sources, which in turn
replicate from a common source), when GTID-based replication is in
use, ensure that any replication filters or other channel
configuration are identical on all channels on the multi-source
replica. With GTID-based replication, filters are applied only to
the transaction data, and GTIDs are not filtered out. This happens
so that a replica’s GTID set stays consistent with the
source’s, meaning GTID auto-positioning can be used without
re-acquiring filtered out transactions each time. In the case
where the downstream replica is multi-source and receives the same
transaction from multiple sources in a diamond topology, the
downstream replica now has multiple versions of the transaction,
and the result depends on which channel applies the transaction
first. The second channel to attempt it skips the transaction
using GTID auto-skip, because the transaction’s GTID was added
to the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
set by the
first channel. With identical filtering on the channels, there is
no problem because all versions of the transaction contain the
same data, so the results are the same. However, with different
filtering on the channels, the database can become inconsistent
and replication can hang.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/table-maintenance-statements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="table-maintenance-statements">
</a>
15.7.3 Table Maintenance Statements
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="analyze-table.html">
15.7.3.1 ANALYZE TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="check-table.html">
15.7.3.2 CHECK TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="checksum-table.html">
15.7.3.3 CHECKSUM TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-table.html">
15.7.3.4 OPTIMIZE TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="repair-table.html">
15.7.3.5 REPAIR TABLE Statement
</a>
</span>
</dt>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/x-plugin-disabling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="x-plugin-disabling">
</a>
22.5.2 Disabling X Plugin
</h3>
</div>
</div>
</div>
<p>
The X Plugin can be disabled at startup by either setting
<a class="link" href="x-plugin-options-system-variables.html#option_mysqld_mysqlx">
<code class="option">
mysqlx=0
</code>
</a>
in your MySQL
configuration file, or by passing in either
<a class="link" href="x-plugin-options-system-variables.html#option_mysqld_mysqlx">
<code class="option">
--mysqlx=0
</code>
</a>
or
<a class="link" href="x-plugin-options-system-variables.html#option_mysqld_mysqlx">
<code class="option">
--skip-mysqlx
</code>
</a>
when starting the MySQL server.
</p>
<p>
Alternatively, use the
<a class="link" href="source-configuration-options.html#option_cmake_with_mysqlx">
<code class="option">
-DWITH_MYSQLX=OFF
</code>
</a>
CMake option to
compile MySQL Server without X Plugin.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-event-reports.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-event-reports">
</a>
25.6.3 Event Reports Generated in NDB Cluster
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-cluster-logging-management-commands.html">
25.6.3.1 NDB Cluster Logging Management Commands
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-log-events.html">
25.6.3.2 NDB Cluster Log Events
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-log-statistics.html">
25.6.3.3 Using CLUSTERLOG STATISTICS in the NDB Cluster Management Client
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045093554976">
</a>
<a class="indexterm" name="idm46045093553488">
</a>
<a class="indexterm" name="idm46045093552400">
</a>
<a class="indexterm" name="idm46045093551328">
</a>
<a class="indexterm" name="idm46045093550256">
</a>
<a class="indexterm" name="idm46045093548768">
</a>
<p>
In this section, we discuss the types of event logs provided by
NDB Cluster, and the types of events that are logged.
</p>
<p>
NDB Cluster provides two types of event log:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<span class="firstterm">
cluster log
</span>
, which
includes events generated by all cluster nodes. The cluster
log is the log recommended for most uses because it provides
logging information for an entire cluster in a single
location.
</p>
<p>
By default, the cluster log is saved to a file named
<code class="filename">
ndb_
<em class="replaceable">
<code>
node_id
</code>
</em>
_cluster.log
</code>
,
(where
<em class="replaceable">
<code>
node_id
</code>
</em>
is the node ID of
the management server) in the management server's
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-datadir">
<code class="literal">
DataDir
</code>
</a>
.
</p>
<p>
Cluster logging information can also be sent to
<code class="literal">
stdout
</code>
or a
<code class="literal">
syslog
</code>
facility in addition to or instead of being saved to a file,
as determined by the values set for the
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-datadir">
<code class="literal">
DataDir
</code>
</a>
and
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-logdestination">
<code class="literal">
LogDestination
</code>
</a>
configuration parameters. See
<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>
, for more
information about these parameters.
</p>
</li>
<li class="listitem">
<p>
<span class="firstterm">
Node logs
</span>
are local to
each node.
</p>
<p>
Output generated by node event logging is written to the file
<code class="filename">
ndb_
<em class="replaceable">
<code>
node_id
</code>
</em>
_out.log
</code>
(where
<em class="replaceable">
<code>
node_id
</code>
</em>
is the node's
node ID) in the node's
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datadir">
<code class="literal">
DataDir
</code>
</a>
. Node event
logs are generated for both management nodes and data nodes.
</p>
<p>
Node logs are intended to be used only during application
development, or for debugging application code.
</p>
</li>
</ul>
</div>
<p>
Each reportable event can be distinguished according to three
different criteria:
</p>
<a class="indexterm" name="idm46045093529456">
</a>
<a class="indexterm" name="idm46045093527968">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Category
</em>
</span>
: This can be any one of the
following values:
<code class="literal">
STARTUP
</code>
,
<code class="literal">
SHUTDOWN
</code>
,
<code class="literal">
STATISTICS
</code>
,
<code class="literal">
CHECKPOINT
</code>
,
<code class="literal">
NODERESTART
</code>
,
<code class="literal">
CONNECTION
</code>
,
<code class="literal">
ERROR
</code>
, or
<code class="literal">
INFO
</code>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Priority
</em>
</span>
: This is represented by one of
the numbers from 0 to 15 inclusive, where 0 indicates
<span class="quote">
“
<span class="quote">
most important
</span>
”
</span>
and 15
<span class="quote">
“
<span class="quote">
least
important.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Severity Level
</em>
</span>
: This can be any one of
the following values:
<code class="literal">
ON
</code>
,
<code class="literal">
DEBUG
</code>
,
<code class="literal">
INFO
</code>
,
<code class="literal">
WARNING
</code>
,
<code class="literal">
ERROR
</code>
,
<code class="literal">
CRITICAL
</code>
,
<code class="literal">
ALERT
</code>
, or
<code class="literal">
ALL
</code>
. (This is also sometimes referred to as
the log level.)
</p>
</li>
</ul>
</div>
<p>
The cluster log can be filtered on these properties using the NDB
management client
<a class="link" href="mysql-cluster-logging-management-commands.html" title="25.6.3.1 NDB Cluster Logging Management Commands">
<code class="literal">
CLUSTERLOG
</code>
</a>
command. This command affects the cluster log only, and has no
effect on the node logs; debug logging in one or more node logs
can be turned on and off using 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>
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-nodelog-debug">
<code class="literal">
NODELOG DEBUG
</code>
</a>
command.
</p>
<p>
The format used in a log message generated by NDB Cluster is as
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa14607205"><div class="copy-help left">Press ⌘+C to 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"><em class="replaceable">timestamp</em> <span class="token punctuation">[</span><em class="replaceable">node_type</em><span class="token punctuation">]</span> <em class="replaceable">level</em> <span class="token operator">--</span> Node <em class="replaceable">node_id</em><span class="token operator">:</span> <em class="replaceable">message</em></code></pre>
</div>
<p>
Each line in the log, or log message, contains the following
information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<em class="replaceable">
<code>
timestamp
</code>
</em>
in
<code class="literal">
<em class="replaceable">
<code>
YYYY
</code>
</em>
-
<em class="replaceable">
<code>
MM
</code>
</em>
-
<em class="replaceable">
<code>
DD
</code>
</em>
<em class="replaceable">
<code>
HH
</code>
</em>
:
<em class="replaceable">
<code>
MM
</code>
</em>
:
<em class="replaceable">
<code>
SS
</code>
</em>
</code>
format. The timestamp value currently resolves to whole
seconds only; fractional seconds are not supported.
</p>
</li>
<li class="listitem">
<p>
The
<em class="replaceable">
<code>
node_type
</code>
</em>
, or type of node or
application which is performing the logging. In the cluster
log, this is always
<code class="literal">
[MgmSrvr]
</code>
; in the data
node log, it is always
<code class="literal">
[ndbd]
</code>
.
<code class="literal">
[NdbApi]
</code>
and other values are possible in
logs generated by NDB API applications and tools.
</p>
</li>
<li class="listitem">
<p>
The
<em class="replaceable">
<code>
level
</code>
</em>
of the event, sometimes
also referred to as its severity level or log level. See
earlier in this section, as well as
<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>
,
for more information about severity levels.
</p>
</li>
<li class="listitem">
<p>
The ID of the node reporting the event
(
<em class="replaceable">
<code>
node_id
</code>
</em>
).
</p>
</li>
<li class="listitem">
<p>
A
<em class="replaceable">
<code>
message
</code>
</em>
containing a description
of the event. The most common types of events to appear in the
log are connections and disconnections between different nodes
in the cluster, and when checkpoints occur. In some cases, the
description may contain status or other information.
</p>
</li>
</ul>
</div>
<p>
A sample from an actual cluster log is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa69802103"><div class="copy-help left">Press ⌘+C to 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">2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 5 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 5 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 6 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 6 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> President restarts arbitration thread <span class="token punctuation">[</span>state<span class="token operator">=</span>1<span class="token punctuation">]</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 7 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 7 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 8 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 8 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 9 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 9 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 50 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 50 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Start phase 101 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Start phase 101 completed <span class="token punctuation">(</span>system restart<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Started <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Started <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Node 50<span class="token operator">:</span> API mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>07 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Node 50<span class="token operator">:</span> API mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Prepare arbitrator node 50 <span class="token punctuation">[</span>ticket<span class="token operator">=</span>75fd00010fa8b608<span class="token punctuation">]</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Started arbitrator node 50 <span class="token punctuation">[</span>ticket<span class="token operator">=</span>75fd00010fa8b608<span class="token punctuation">]</span>
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Communication to Node 100 opened
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Communication to Node 101 opened
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Communication to Node 100 opened
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>08 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Communication to Node 101 opened
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Alloc node id 100 succeeded
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Nodeid 100 allocated for API at 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 100<span class="token operator">:</span> mysqld <span class="token operator">--</span>server<span class="token operator">-</span>id<span class="token operator">=</span>1
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Node 100 Connected
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Node 100 Connected
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 5<span class="token operator">:</span> Node 100<span class="token operator">:</span> API mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0
2021<span class="token operator">-</span>06<span class="token operator">-</span>10 10<span class="token operator">:</span>01<span class="token operator">:</span>36 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 6<span class="token operator">:</span> Node 100<span class="token operator">:</span> API mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0 ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0</code></pre>
</div>
<p>
For additional information, see
<a class="xref" href="mysql-cluster-log-events.html" title="25.6.3.2 NDB Cluster Log Events">
Section 25.6.3.2, “NDB Cluster Log Events”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-ndb-sync-excluded-objects-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-ndb-sync-excluded-objects-table">
</a>
29.12.12.2 The ndb_sync_excluded_objects Table
</h4>
</div>
</div>
</div>
<p>
This table provides information about
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
database objects which cannot
be automatically synchronized between NDB Cluster's
dictionary and the MySQL data dictionary.
</p>
<p>
Example information about
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
database objects which cannot be synchronized with the MySQL
data dictionary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30486002"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>ndb_sync_excluded_objects\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>
SCHEMA_NAME<span class="token punctuation">:</span> NULL
NAME<span class="token punctuation">:</span> lg1
TYPE<span class="token punctuation">:</span> LOGFILE GROUP
REASON<span class="token punctuation">:</span> Injected failure
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
SCHEMA_NAME<span class="token punctuation">:</span> NULL
NAME<span class="token punctuation">:</span> ts1
TYPE<span class="token punctuation">:</span> TABLESPACE
REASON<span class="token punctuation">:</span> Injected failure
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
SCHEMA_NAME<span class="token punctuation">:</span> db1
NAME<span class="token punctuation">:</span> NULL
TYPE<span class="token punctuation">:</span> SCHEMA
REASON<span class="token punctuation">:</span> Injected failure
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
SCHEMA_NAME<span class="token punctuation">:</span> test
NAME<span class="token punctuation">:</span> t1
TYPE<span class="token punctuation">:</span> TABLE
REASON<span class="token punctuation">:</span> Injected failure
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
SCHEMA_NAME<span class="token punctuation">:</span> test
NAME<span class="token punctuation">:</span> t2
TYPE<span class="token punctuation">:</span> TABLE
REASON<span class="token punctuation">:</span> Injected failure
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 6. 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>
SCHEMA_NAME<span class="token punctuation">:</span> test
NAME<span class="token punctuation">:</span> t3
TYPE<span class="token punctuation">:</span> TABLE
REASON<span class="token punctuation">:</span> Injected failure</span></code></pre>
</div>
<p>
The
<a class="link" href="performance-schema-ndb-sync-excluded-objects-table.html" title="29.12.12.2 The ndb_sync_excluded_objects Table">
<code class="literal">
ndb_sync_excluded_objects
</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">
SCHEMA_NAME
</code>
: The name of the schema
(database) in which the object which has failed to
synchronize resides; this is
<code class="literal">
NULL
</code>
for
tablespaces and log file groups
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NAME
</code>
: The name of the object which has
failed to synchronize; this is
<code class="literal">
NULL
</code>
if
the object is a schema
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TYPE
</code>
: The type of the object has failed
to synchronize; this is one of
<code class="literal">
LOGFILE
GROUP
</code>
,
<code class="literal">
TABLESPACE
</code>
,
<code class="literal">
SCHEMA
</code>
, or
<code class="literal">
TABLE
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REASON
</code>
: The reason for exclusion
(blocklisting) of the object; that is, the reason for the
failure to synchronize this object
</p>
<p>
Possible reasons include the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Injected failure
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to determine if object existed in
NDB
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to determine if object existed in
DD
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to drop object in DD
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to get undofiles assigned to logfile
group
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to get object id and version
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to install object in DD
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to get datafiles assigned to
tablespace
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to create schema
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to determine if object was a local
table
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to invalidate table
references
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to set database name of NDB
object
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to get extra metadata of
table
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to migrate table with extra metadata
version 1
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to get object from DD
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Definition of table has changed in NDB
Dictionary
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Failed to setup binlogging for
table
</code>
</p>
</li>
</ul>
</div>
<p>
This list is not necessarily exhaustive, and is subject to
change in future
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
releases.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqlbinlog.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysqlbinlog">
</a>
6.6.9 mysqlbinlog — Utility for Processing Binary Log Files
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysqlbinlog-hexdump.html">
6.6.9.1 mysqlbinlog Hex Dump Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlbinlog-row-events.html">
6.6.9.2 mysqlbinlog Row Event Display
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlbinlog-backup.html">
6.6.9.3 Using mysqlbinlog to Back Up Binary Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlbinlog-server-id.html">
6.6.9.4 Specifying the mysqlbinlog Server ID
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045305260944">
</a>
<p>
The server's binary log consists of files containing
<span class="quote">
“
<span class="quote">
events
</span>
”
</span>
that describe modifications to database
contents. The server writes these files in binary format. To
display their contents in text format, use the
<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>
utility. You can also use
<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>
to display the contents of relay
log files written by a replica server in a replication setup
because relay logs have the same format as binary logs. The
binary log and relay log are discussed further in
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
, and
<a class="xref" href="replica-logs.html" title="19.2.4 Relay Log and Replication Metadata Repositories">
Section 19.2.4, “Relay Log and Replication Metadata Repositories”
</a>
.
</p>
<p>
Invoke
<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>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa21232066"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">log_file</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
For example, to display the contents of the binary log file
named
<code class="filename">
binlog.000003
</code>
, use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa19097330"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000003</code></pre>
</div>
<p>
The output includes events contained in
<code class="filename">
binlog.000003
</code>
. For statement-based logging,
event information includes the SQL statement, the ID of the
server on which it was executed, the timestamp when the
statement was executed, how much time it took, and so forth. For
row-based logging, the event indicates a row change rather than
an SQL statement. See
<a class="xref" href="replication-formats.html" title="19.2.1 Replication Formats">
Section 19.2.1, “Replication Formats”
</a>
, for
information about logging modes.
</p>
<p>
Events are preceded by header comments that provide additional
information. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa11419358"><div class="copy-help left">Press ⌘+C to 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"># at 141
#100309 9:28:36 server id 123 end_log_pos 245
Query thread_id=3350 exec_time=11 error_code=0</code></pre>
</div>
<p>
In the first line, the number following
<code class="literal">
at
</code>
indicates the file offset, or starting position, of the event in
the binary log file.
</p>
<p>
The second line starts with a date and time indicating when the
statement started on the server where the event originated. For
replication, this timestamp is propagated to replica servers.
<code class="literal">
server id
</code>
is the
<a class="link" href="replication-options.html#sysvar_server_id">
<code class="literal">
server_id
</code>
</a>
value of the server
where the event originated.
<code class="literal">
end_log_pos
</code>
indicates where the next event starts (that is, it is the end
position of the current event + 1).
<code class="literal">
thread_id
</code>
indicates which thread executed the event.
<code class="literal">
exec_time
</code>
is the time spent executing the
event, on a replication source server. On a replica, it is the
difference of the end execution time on the replica minus the
beginning execution time on the source. The difference serves as
an indicator of how much replication lags behind the source.
<code class="literal">
error_code
</code>
indicates the result from
executing the event. Zero means that no error occurred.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When using event groups, the file offsets of events may be
grouped together and the comments of events may be grouped
together. Do not mistake these grouped events for blank file
offsets.
</p>
</div>
<p>
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>
can be
re-executed (for example, by using it as input to
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
) to redo the statements in the log.
This is useful for recovery operations after an unexpected
server exit. For other usage examples, see the discussion later
in this section and in
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
.
To execute the internal-use
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
statements used by
<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>
, the user requires the
<a class="link" href="privileges-provided.html#priv_binlog-admin">
<code class="literal">
BINLOG_ADMIN
</code>
</a>
privilege (or the
deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege), or
the
<a class="link" href="privileges-provided.html#priv_replication-applier">
<code class="literal">
REPLICATION_APPLIER
</code>
</a>
privilege
plus the appropriate privileges to execute each log event.
</p>
<p>
You can use
<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>
to read binary log
files directly and apply them to the local MySQL server. You can
also read binary logs from a remote server by using the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
option. To read remote binary logs, the connection parameter
options can be given to indicate how to connect to the server.
These options are
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_host">
<code class="option">
--host
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--password
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_port">
<code class="option">
--port
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_protocol">
<code class="option">
--protocol
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_socket">
<code class="option">
--socket
</code>
</a>
, and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_user">
<code class="option">
--user
</code>
</a>
.
</p>
<p>
When binary log files have been encrypted,
<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>
cannot read them directly, but
can read them from the server using the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
option. Binary log files are encrypted when the server's
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_encryption">
<code class="literal">
binlog_encryption
</code>
</a>
system
variable is set to
<code class="literal">
ON
</code>
. The
<a class="link" href="show-binary-logs.html" title="15.7.7.2 SHOW BINARY LOGS Statement">
<code class="literal">
SHOW BINARY LOGS
</code>
</a>
statement shows
whether a particular binary log file is encrypted or
unencrypted. Encrypted and unencrypted binary log files can also
be distinguished using the magic number at the start of the file
header for encrypted log files (
<code class="literal">
0xFD62696E
</code>
),
which differs from that used for unencrypted log files
(
<code class="literal">
0xFE62696E
</code>
). Note that
<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>
returns a suitable error if you
attempt to read an encrypted binary log file directly, but older
versions of
<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>
do not recognise the
file as a binary log file at all. For more information on binary
log encryption, see
<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>
.
</p>
<p>
When binary log transaction payloads have been compressed,
<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>
automatically decompresses and
decodes the transaction payloads, and prints them as it would
uncompressed events. When
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
<code class="literal">
binlog_transaction_compression
</code>
</a>
is set to
<code class="literal">
ON
</code>
, transaction payloads are
compressed and then written to the server's binary log file as a
single event (a
<code class="literal">
Transaction_payload_event
</code>
).
With the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
<code class="option">
--verbose
</code>
</a>
option,
<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>
adds comments stating the
compression algorithm used, the compressed payload size that was
originally received, and the resulting payload size after
decompression.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The end position (
<code class="literal">
end_log_pos
</code>
) that
<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>
states for an individual event
that was part of a compressed transaction payload is the same
as the end position of the original compressed payload.
Multiple decompressed events can therefore have the same end
position.
</p>
<p>
<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>
's own connection compression
does less if transaction payloads are already compressed, but
still operates on uncompressed transactions and headers.
</p>
</div>
<p>
For more information on binary log transaction compression, see
<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>
.
</p>
<p>
When running
<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>
against a large
binary log, be careful that the filesystem has enough space for
the resulting files. To configure the directory that
<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>
uses for temporary files, use the
<code class="literal">
TMPDIR
</code>
environment variable.
</p>
<p>
<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>
sets the value of
<a class="link" href="server-system-variables.html#sysvar_pseudo_replica_mode">
<code class="literal">
pseudo_replica_mode
</code>
</a>
to true
before executing any SQL statements. This system variable
affects the handling of XA transactions, the
<code class="literal">
original_commit_timestamp
</code>
replication delay
timestamp and the
<a class="link" href="replication-options-source.html#sysvar_original_server_version">
<code class="literal">
original_server_version
</code>
</a>
system
variable, and unsupported SQL modes.
</p>
<p>
<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>
supports the following options,
which can be specified on the command line or in the
<code class="literal">
[mysqlbinlog]
</code>
and
<code class="literal">
[client]
</code>
groups of an option file. For information about option files
used by MySQL programs, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<div class="table">
<a name="idm46045305178320">
</a>
<p class="title">
<b>
Table 6.20 mysqlbinlog Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for mysqlbinlog.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
--base64-output
</a>
</td>
<td>
Print binary log entries using base-64 encoding
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_bind-address">
--bind-address
</a>
</td>
<td>
Use specified network interface to connect to MySQL Server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_binlog-row-event-max-size">
--binlog-row-event-max-size
</a>
</td>
<td>
Binary log max event size
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_character-sets-dir">
--character-sets-dir
</a>
</td>
<td>
Directory where character sets are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_compress">
--compress
</a>
</td>
<td>
Compress all information sent between client and server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_compression-algorithms">
--compression-algorithms
</a>
</td>
<td>
Permitted compression algorithms for connections to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
--connection-server-id
</a>
</td>
<td>
Used for testing and debugging. See text for applicable default values and other particulars
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
--database
</a>
</td>
<td>
List entries for just this database
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_debug">
--debug
</a>
</td>
<td>
Write debugging log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_debug-check">
--debug-check
</a>
</td>
<td>
Print debugging information when program exits
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_debug-info">
--debug-info
</a>
</td>
<td>
Print debugging information, memory, and CPU statistics when program exits
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_default-auth">
--default-auth
</a>
</td>
<td>
Authentication plugin to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_defaults-extra-file">
--defaults-extra-file
</a>
</td>
<td>
Read named option file in addition to usual option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_defaults-group-suffix">
--defaults-group-suffix
</a>
</td>
<td>
Option group suffix value
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_disable-log-bin">
--disable-log-bin
</a>
</td>
<td>
Disable binary logging
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_exclude-gtids">
--exclude-gtids
</a>
</td>
<td>
Do not show any of the groups in the GTID set provided
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_force-if-open">
--force-if-open
</a>
</td>
<td>
Read binary log files even if open or not closed properly
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_force-read">
--force-read
</a>
</td>
<td>
If mysqlbinlog reads a binary log event that it does not recognize, it prints a warning
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_get-server-public-key">
--get-server-public-key
</a>
</td>
<td>
Request RSA public key from server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_help">
--help
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_hexdump">
--hexdump
</a>
</td>
<td>
Display a hex dump of the log in comments
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_host">
--host
</a>
</td>
<td>
Host on which MySQL server is located
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_idempotent">
--idempotent
</a>
</td>
<td>
Cause the server to use idempotent mode while processing binary log updates from this session only
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_include-gtids">
--include-gtids
</a>
</td>
<td>
Show only the groups in the GTID set provided
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
--local-load
</a>
</td>
<td>
Prepare local temporary files for LOAD DATA in the specified directory
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_login-path">
--login-path
</a>
</td>
<td>
Read login path options from .mylogin.cnf
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_no-login-paths">
--no-login-paths
</a>
</td>
<td>
Do not read login paths from the login path file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_offset">
--offset
</a>
</td>
<td>
Skip the first N entries in the log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
--password
</a>
</td>
<td>
Password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_plugin-dir">
--plugin-dir
</a>
</td>
<td>
Directory where plugins are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_port">
--port
</a>
</td>
<td>
TCP/IP port number for connection
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_print-defaults">
--print-defaults
</a>
</td>
<td>
Print default options
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_print-table-metadata">
--print-table-metadata
</a>
</td>
<td>
Print table metadata
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_protocol">
--protocol
</a>
</td>
<td>
Transport protocol to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
--raw
</a>
</td>
<td>
Write events in raw (binary) format to output files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-master">
--read-from-remote-master
</a>
</td>
<td>
Read the binary log from a MySQL replication source server rather than reading a local log file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
--read-from-remote-server
</a>
</td>
<td>
Read binary log from MySQL server rather than local log file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
--read-from-remote-source
</a>
</td>
<td>
Read the binary log from a MySQL replication source server rather than reading a local log file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_require-row-format">
--require-row-format
</a>
</td>
<td>
Require row-based binary logging format
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_result-file">
--result-file
</a>
</td>
<td>
Direct output to named file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_rewrite-db">
--rewrite-db
</a>
</td>
<td>
Create rewrite rules for databases when playing back from logs written in row-based format. Can be used multiple times
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-id">
--server-id
</a>
</td>
<td>
Extract only those events created by the server having the given server ID
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-id-bits">
--server-id-bits
</a>
</td>
<td>
Tell mysqlbinlog how to interpret server IDs in binary log when log was written by a mysqld having its server-id-bits set to less than the maximum; supported only by MySQL Cluster version of mysqlbinlog
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-public-key-path">
--server-public-key-path
</a>
</td>
<td>
Path name to file containing RSA public key
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_set-charset">
--set-charset
</a>
</td>
<td>
Add a SET NAMES charset_name statement to the output
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_shared-memory-base-name">
--shared-memory-base-name
</a>
</td>
<td>
Shared-memory name for shared-memory connections (Windows only)
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_short-form">
--short-form
</a>
</td>
<td>
Display only the statements contained in the log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_skip-gtids">
--skip-gtids
</a>
</td>
<td>
Do not include the GTIDs from the binary log files in the output dump file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_socket">
--socket
</a>
</td>
<td>
Unix socket file or Windows named pipe to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-ca
</a>
</td>
<td>
File that contains list of trusted SSL Certificate Authorities
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-capath
</a>
</td>
<td>
Directory that contains trusted SSL Certificate Authority certificate files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-cert
</a>
</td>
<td>
File that contains X.509 certificate
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-cipher
</a>
</td>
<td>
Permissible ciphers for connection encryption
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-crl
</a>
</td>
<td>
File that contains certificate revocation lists
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-crlpath
</a>
</td>
<td>
Directory that contains certificate revocation-list files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
--ssl-fips-mode
</a>
</td>
<td>
Whether to enable FIPS mode on client side
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-key
</a>
</td>
<td>
File that contains X.509 key
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-mode
</a>
</td>
<td>
Desired security state of connection to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-session-data
</a>
</td>
<td>
File that contains SSL session data
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl">
--ssl-session-data-continue-on-failed-reuse
</a>
</td>
<td>
Whether to establish connections if session reuse fails
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-datetime">
--start-datetime
</a>
</td>
<td>
Read binary log from first event with timestamp equal to or later than datetime argument
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-position">
--start-position
</a>
</td>
<td>
Decode binary log from first event with position equal to or greater than argument
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-datetime">
--stop-datetime
</a>
</td>
<td>
Stop reading binary log at first event with timestamp equal to or greater than datetime argument
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
--stop-never
</a>
</td>
<td>
Stay connected to server after reading last binary log file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never-slave-server-id">
--stop-never-slave-server-id
</a>
</td>
<td>
Slave server ID to report when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-position">
--stop-position
</a>
</td>
<td>
Stop decoding binary log at first event with position equal to or greater than argument
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-ciphersuites">
--tls-ciphersuites
</a>
</td>
<td>
Permissible TLSv1.3 ciphersuites for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-sni-servername">
--tls-sni-servername
</a>
</td>
<td>
Server name supplied by the client
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-version">
--tls-version
</a>
</td>
<td>
Permissible TLS protocols for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_to-last-log">
--to-last-log
</a>
</td>
<td>
Do not stop at the end of requested binary log from a MySQL server, but rather continue printing to end of last binary log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_user">
--user
</a>
</td>
<td>
MySQL user name to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
--verbose
</a>
</td>
<td>
Reconstruct row events as SQL statements
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verify-binlog-checksum">
--verify-binlog-checksum
</a>
</td>
<td>
Verify checksums in binary log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_version">
--version
</a>
</td>
<td>
Display version information and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_zstd-compression-level">
--zstd-compression-level
</a>
</td>
<td>
Compression level for connections to server that use zstd compression
</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: 260.906px;">
Option Name
</th>
<th style="width: 477.094px;">
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">
<p>
<a name="option_mysqlbinlog_help">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304952784">
</a>
<a class="indexterm" name="idm46045304951296">
</a>
<p>
Display a help message and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_base64-output">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
<code class="option">
--base64-output=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for base64-output">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--base64-output=value
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
AUTO
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
AUTO
</code>
</p>
<p class="valid-value">
<code class="literal">
NEVER
</code>
</p>
<p class="valid-value">
<code class="literal">
DECODE-ROWS
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304932080">
</a>
<a class="indexterm" name="idm46045304930592">
</a>
<p>
This option determines when events should be displayed
encoded as base-64 strings using
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
statements. The option
has these permissible values (not case-sensitive):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
AUTO
</code>
("automatic") or
<code class="literal">
UNSPEC
</code>
("unspecified") displays
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
statements
automatically when necessary (that is, for format
description events and row events). If no
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
<code class="option">
--base64-output
</code>
</a>
option is given, the effect is the same as
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
<code class="option">
--base64-output=AUTO
</code>
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Automatic
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
display is the only safe behavior if you intend to use
the output of
<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>
to
re-execute binary log file contents. The other option
values are intended only for debugging or testing
purposes because they may produce output that does not
include all events in executable form.
</p>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
NEVER
</code>
causes
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
statements not to
be displayed.
<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>
exits with
an error if a row event is found that must be displayed
using
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DECODE-ROWS
</code>
specifies to
<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>
that you intend for row
events to be decoded and displayed as commented SQL
statements by also specifying the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
<code class="option">
--verbose
</code>
</a>
option.
Like
<code class="literal">
NEVER
</code>
,
<code class="literal">
DECODE-ROWS
</code>
suppresses display of
<a class="link" href="binlog.html" title="15.7.8.1 BINLOG Statement">
<code class="literal">
BINLOG
</code>
</a>
statements, but
unlike
<code class="literal">
NEVER
</code>
, it does not exit with
an error if a row event is found.
</p>
</li>
</ul>
</div>
<p>
For examples that show the effect of
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
<code class="option">
--base64-output
</code>
</a>
and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
<code class="option">
--verbose
</code>
</a>
on row event
output, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_bind-address">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_bind-address">
<code class="option">
--bind-address=
<em class="replaceable">
<code>
ip_address
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for bind-address">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--bind-address=ip_address
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304893488">
</a>
<a class="indexterm" name="idm46045304892000">
</a>
<p>
On a computer having multiple network interfaces, use this
option to select which interface to use for connecting to
the MySQL server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_binlog-row-event-max-size">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_binlog-row-event-max-size">
<code class="option">
--binlog-row-event-max-size=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for binlog-row-event-max-size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--binlog-row-event-max-size=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
4294967040
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
256
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
18446744073709547520
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304872512">
</a>
<a class="indexterm" name="idm46045304871008">
</a>
<p>
Specify the maximum size of a row-based binary log event, in
bytes. Rows are grouped into events smaller than this size
if possible. The value should be a multiple of 256. The
default is 4GB.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_character-sets-dir">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_character-sets-dir">
<code class="option">
--character-sets-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304858848">
</a>
<a class="indexterm" name="idm46045304857344">
</a>
<p>
The directory where character sets are installed. 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>
<a name="option_mysqlbinlog_compress">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_compress">
<code class="option">
--compress
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compress">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compress[={OFF|ON}]
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304840464">
</a>
<a class="indexterm" name="idm46045304838976">
</a>
<p>
Compress all information sent between the client and the
server if possible. 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>
This option is deprecated. Expect it to be removed in a
future version of MySQL. See
<a class="xref" href="connection-compression-control.html#connection-compression-legacy-configuration" title="Configuring Legacy Connection Compression">
Configuring Legacy Connection Compression
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_compression-algorithms">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_compression-algorithms">
<code class="option">
--compression-algorithms=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compression-algorithms">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compression-algorithms=value
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Set
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
uncompressed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
zlib
</code>
</p>
<p class="valid-value">
<code class="literal">
zstd
</code>
</p>
<p class="valid-value">
<code class="literal">
uncompressed
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304817664">
</a>
<a class="indexterm" name="idm46045304816160">
</a>
<p>
The permitted compression algorithms for connections to the
server. The available algorithms are the same as for the
<a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
<code class="literal">
protocol_compression_algorithms
</code>
</a>
system variable. The default value is
<code class="literal">
uncompressed
</code>
.
</p>
<p>
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>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_connection-server-id">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
<code class="option">
--connection-server-id=
<em class="replaceable">
<code>
server_id
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connection-server-id">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connection-server-id=#]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0 (1)
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0 (1)
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
4294967295
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304793616">
</a>
<a class="indexterm" name="idm46045304792112">
</a>
<p>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
<code class="option">
--connection-server-id
</code>
</a>
specifies the server ID that
<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>
reports when it connects to the server. It can be used to
avoid a conflict with the ID of a replica server or another
<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>
process.
</p>
<p>
If the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
option is specified,
<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>
reports
a server ID of 0, which tells the server to disconnect after
sending the last log file (nonblocking behavior). If the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
option is
also specified to maintain the connection to the server,
<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>
reports a server ID of 1 by
default instead of 0, and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
<code class="option">
--connection-server-id
</code>
</a>
can be used to replace that server ID if required. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_database">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database=
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</a>
,
<code class="option">
-d
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--database=db_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304768736">
</a>
<a class="indexterm" name="idm46045304767248">
</a>
<p>
This option causes
<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>
to output
entries from the binary log (local log only) that occur
while
<em class="replaceable">
<code>
db_name
</code>
</em>
is been selected as
the default database by
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
.
</p>
<p>
The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database
</code>
</a>
option
for
<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>
is similar to the
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db
</code>
</a>
option for
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, but can be used to specify only
one database. If
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database
</code>
</a>
is given
multiple times, only the last instance is used.
</p>
<p>
The effects of this option depend on whether the
statement-based or row-based logging format is in use, in
the same way that the effects of
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db
</code>
</a>
depend on
whether statement-based or row-based logging is in use.
</p>
<p>
<b>
Statement-based logging.
</b>
The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database
</code>
</a>
option
works as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
While
<em class="replaceable">
<code>
db_name
</code>
</em>
is the default
database, statements are output whether they modify
tables in
<em class="replaceable">
<code>
db_name
</code>
</em>
or a
different database.
</p>
</li>
<li class="listitem">
<p>
Unless
<em class="replaceable">
<code>
db_name
</code>
</em>
is selected as
the default database, statements are not output, even if
they modify tables in
<em class="replaceable">
<code>
db_name
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
There is an exception for
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE
DATABASE
</code>
</a>
,
<a class="link" href="alter-database.html" title="15.1.2 ALTER DATABASE Statement">
<code class="literal">
ALTER
DATABASE
</code>
</a>
, and
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP
DATABASE
</code>
</a>
. The database being
<span class="emphasis">
<em>
created, altered, or dropped
</em>
</span>
is
considered to be the default database when determining
whether to output the statement.
</p>
</li>
</ul>
</div>
<p>
Suppose that the binary log was created by executing these
statements using statement-based-logging:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77013981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INSERT</span> <span class="token keyword">INTO</span> test<span class="token punctuation">.</span>t1 <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> db2<span class="token punctuation">.</span>t2 <span class="token punctuation">(</span>j<span class="token punctuation">)</span> <span class="token keyword">VALUES</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 keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> test<span class="token punctuation">.</span>t1 <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">101</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 punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">102</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> db2<span class="token punctuation">.</span>t2 <span class="token punctuation">(</span>j<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">201</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">USE</span> db2<span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> test<span class="token punctuation">.</span>t1 <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">103</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> db2<span class="token punctuation">.</span>t2 <span class="token punctuation">(</span>j<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">202</span><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 punctuation">(</span>j<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">203</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog --database=test
</strong>
</span>
</a>
does not
output the first two
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements because there is no default database. It outputs
the three
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements
following
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
test
</code>
</a>
, but not the three
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements following
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE db2
</code>
</a>
.
</p>
<p>
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog --database=db2
</strong>
</span>
</a>
does not
output the first two
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements because there is no default database. It does not
output the three
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements following
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE test
</code>
</a>
, but
does output the three
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements following
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE db2
</code>
</a>
.
</p>
<p>
<b>
Row-based logging.
</b>
<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>
outputs only entries that
change tables belonging to
<em class="replaceable">
<code>
db_name
</code>
</em>
. The default database
has no effect on this. Suppose that the binary log just
described was created using row-based logging rather than
statement-based logging.
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
--database=test
</strong>
</span>
</a>
outputs only those entries that
modify
<code class="literal">
t1
</code>
in the test database,
regardless of whether
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
was issued or what the default database is.
</p>
<p>
If a server is running with
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
set to
<code class="literal">
MIXED
</code>
and you want it to be possible to
use
<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>
with the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database
</code>
</a>
option, you
must ensure that tables that are modified are in the
database selected by
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
. (In
particular, no cross-database updates should be used.)
</p>
<p>
When used together with the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_rewrite-db">
<code class="option">
--rewrite-db
</code>
</a>
option, the
<code class="option">
--rewrite-db
</code>
option is applied first; then
the
<code class="option">
--database
</code>
option is applied, using the
rewritten database name. The order in which the options are
provided makes no difference in this regard.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_debug">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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/mysqlbinlog.trace
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304697104">
</a>
<a class="indexterm" name="idm46045304695616">
</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/mysqlbinlog.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_mysqlbinlog_debug-check">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_debug-check">
<code class="option">
--debug-check
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug-check
</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="idm46045304677360">
</a>
<a class="indexterm" name="idm46045304675872">
</a>
<p>
Print some debugging information when the program exits.
</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_mysqlbinlog_debug-info">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_debug-info">
<code class="option">
--debug-info
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug-info">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug-info
</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="idm46045304659760">
</a>
<a class="indexterm" name="idm46045304658272">
</a>
<p>
Print debugging information and memory and CPU usage
statistics when the program exits.
</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_mysqlbinlog_default-auth">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_default-auth">
<code class="option">
--default-auth=
<em class="replaceable">
<code>
plugin
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for default-auth">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--default-auth=plugin
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304644336">
</a>
<a class="indexterm" name="idm46045304642848">
</a>
<p>
A hint about which client-side authentication plugin to use.
See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_defaults-extra-file">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304630160">
</a>
<a class="indexterm" name="idm46045304628656">
</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_mysqlbinlog_defaults-file">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304614816">
</a>
<a class="indexterm" name="idm46045304613328">
</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>
Exception: Even with
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
, client
programs read
<code class="filename">
.mylogin.cnf
</code>
.
</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_mysqlbinlog_defaults-group-suffix">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304597296">
</a>
<a class="indexterm" name="idm46045304595792">
</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="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
normally reads the
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysqlbinlog]
</code>
groups. If this option is
given as
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=_other
</code>
</a>
,
<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>
also reads the
<code class="literal">
[client_other]
</code>
and
<code class="literal">
[mysqlbinlog_other]
</code>
groups.
</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_mysqlbinlog_disable-log-bin">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_disable-log-bin">
<code class="option">
--disable-log-bin
</code>
</a>
,
<code class="option">
-D
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for disable-log-bin">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--disable-log-bin
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304577696">
</a>
<a class="indexterm" name="idm46045304576208">
</a>
<p>
Disable binary logging. This is useful for avoiding an
endless loop if you use the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_to-last-log">
<code class="option">
--to-last-log
</code>
</a>
option and
are sending the output to the same MySQL server. This option
also is useful when restoring after an unexpected exit to
avoid duplication of the statements you have logged.
</p>
<p>
This option causes
<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>
to include
a
<a class="link" href="set-sql-log-bin.html" title="15.4.1.3 SET sql_log_bin Statement">
<code class="literal">
SET
sql_log_bin = 0
</code>
</a>
statement in its output to disable
binary logging of the remaining output. Manipulating the
session value of the
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin
</code>
</a>
system variable
is a restricted operation, so this option requires that you
have privileges sufficient to set restricted session
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>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_exclude-gtids">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_exclude-gtids">
<code class="option">
--exclude-gtids=
<em class="replaceable">
<code>
gtid_set
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-gtids">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-gtids=gtid_set
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304554960">
</a>
<a class="indexterm" name="idm46045304553472">
</a>
<p>
Do not display any of the groups listed in the
<em class="replaceable">
<code>
gtid_set
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_force-if-open">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_force-if-open">
<code class="option">
--force-if-open
</code>
</a>
,
<code class="option">
-F
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for force-if-open">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--force-if-open
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304542992">
</a>
<a class="indexterm" name="idm46045304541504">
</a>
<p>
Read binary log files even if they are open or were not
closed properly (
<code class="literal">
IN_USE
</code>
flag is set); do
not fail if the file ends with a truncated event.
</p>
<p>
The
<code class="literal">
IN_USE
</code>
flag is set only for the
binary log that is currently written by the server; if the
server has crashed, the flag remains set until the server is
started up again and recovers the binary log. Without this
option,
<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>
refuses to process a
file with this flag set. Since the server may be in the
process of writing the file, truncation of the last event is
considered normal.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_force-read">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_force-read">
<code class="option">
--force-read
</code>
</a>
,
<code class="option">
-f
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for force-read">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--force-read
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304527856">
</a>
<a class="indexterm" name="idm46045304526368">
</a>
<p>
With this option, if
<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>
reads a
binary log event that it does not recognize, it prints a
warning, ignores the event, and continues. Without this
option,
<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>
stops if it reads
such an event.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_get-server-public-key">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for get-server-public-key">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--get-server-public-key
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304511904">
</a>
<a class="indexterm" name="idm46045304510400">
</a>
<p>
Request from the server the public key required for RSA key
pair-based password exchange. This option applies to clients
that authenticate with the
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. For that plugin, the server does not send the public
key unless requested. This option is ignored for accounts
that do not authenticate with that plugin. It is also
ignored if RSA-based password exchange is not used, as is
the case when the client connects to the server using a
secure connection.
</p>
<p>
If
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
For information about the
<code class="literal">
caching_sha2_password
</code>
plugin, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_hexdump">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_hexdump">
<code class="option">
--hexdump
</code>
</a>
,
<code class="option">
-H
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for hexdump">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--hexdump
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304494400">
</a>
<a class="indexterm" name="idm46045304492912">
</a>
<p>
Display a hex dump of the log in comments, as described in
<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>
. The hex output can be
helpful for replication debugging.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_host">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_host">
<code class="option">
--host=
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</a>
,
<code class="option">
-h
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--host=host_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
localhost
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304477024">
</a>
<a class="indexterm" name="idm46045304475536">
</a>
<p>
Get the binary log from the MySQL server on the given host.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_idempotent">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_idempotent">
<code class="option">
--idempotent
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for idempotent">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--idempotent
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
true
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304461360">
</a>
<a class="indexterm" name="idm46045304459872">
</a>
<p>
Tell the MySQL Server to use idempotent mode while
processing updates; this causes suppression of any
duplicate-key or key-not-found errors that the server
encounters in the current session while processing updates.
This option may prove useful whenever it is desirable or
necessary to replay one or more binary logs to a MySQL
Server which may not contain all of the data to which the
logs refer.
</p>
<p>
The scope of effect for this option includes the current
<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>
client and session only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_include-gtids">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_include-gtids">
<code class="option">
--include-gtids=
<em class="replaceable">
<code>
gtid_set
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for include-gtids">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--include-gtids=gtid_set
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304443392">
</a>
<a class="indexterm" name="idm46045304441904">
</a>
<p>
Display only the groups listed in the
<em class="replaceable">
<code>
gtid_set
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_local-load">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
,
<code class="option">
-l
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for local-load">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--local-load=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304428704">
</a>
<a class="indexterm" name="idm46045304427216">
</a>
<p>
For data loading operations corresponding to
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statements,
<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>
extracts the files from the
binary log events, writes them as temporary files to the
local file system, and writes
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statements to cause the files to be loaded.
By default,
<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>
writes these
temporary files to an operating system-specific directory.
The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load
</code>
</a>
option
can be used to explicitly specify the directory where
<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>
should prepare local
temporary files.
</p>
<p>
Because other processes can write files to the default
system-specific directory, it is advisable to specify the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load
</code>
</a>
option to
<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>
to designate a different
directory for data files, and then designate that same
directory by specifying the
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
option
to
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
when processing 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>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa59998111"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token constant">--local-load</span><span class="token attr-value"><span class="token punctuation">=</span>/my/local/data</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
| mysql <span class="token constant">--load-data-local-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/my/local/data</span> <span class="token punctuation">.</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>
These temporary files are not automatically removed by
<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>
or any other MySQL program.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_login-path">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_login-path">
<code class="option">
--login-path=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304398144">
</a>
<a class="indexterm" name="idm46045304396656">
</a>
<p>
Read options from the named login path in the
<code class="filename">
.mylogin.cnf
</code>
login path file. A
<span class="quote">
“
<span class="quote">
login path
</span>
”
</span>
is an option group containing
options that specify which MySQL server to connect to and
which account to authenticate as. To create or modify a
login path file, 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_mysqlbinlog_no-login-paths">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304382576">
</a>
<a class="indexterm" name="idm46045304381088">
</a>
<p>
Skips reading options from the login path file.
</p>
<p>
See
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_login-path">
<code class="option">
--login-path
</code>
</a>
for
related information.
</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_mysqlbinlog_no-defaults">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304368880">
</a>
<a class="indexterm" name="idm46045304367392">
</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="mysqlbinlog.html#option_mysqlbinlog_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="mysqlbinlog.html#option_mysqlbinlog_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_mysqlbinlog_offset">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_offset">
<code class="option">
--offset=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
,
<code class="option">
-o
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for offset">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--offset=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304347536">
</a>
<a class="indexterm" name="idm46045304346048">
</a>
<p>
Skip the first
<em class="replaceable">
<code>
N
</code>
</em>
entries in the
log.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_open-files-limit">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_open-files-limit">
<code class="option">
--open-files-limit=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for open-files-limit">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--open-files-limit=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
8
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
[platform dependent]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304326384">
</a>
<a class="indexterm" name="idm46045304324896">
</a>
<a class="indexterm" name="idm46045304323408">
</a>
<p>
Specify the number of open file descriptors to reserve.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_password">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--password[=
<em class="replaceable">
<code>
password
</code>
</em>
]
</code>
</a>
,
<code class="option">
-p[
<em class="replaceable">
<code>
password
</code>
</em>
]
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304310464">
</a>
<a class="indexterm" name="idm46045304308976">
</a>
<p>
The password of the MySQL account used for connecting to the
server. The password value is optional. If not given,
<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>
prompts for one. If given,
there must be
<span class="emphasis">
<em>
no space
</em>
</span>
between
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--password=
</code>
</a>
or
<code class="option">
-p
</code>
and the password following it. If no
password option is specified, the default is to send no
password.
</p>
<p>
Specifying a password on the command line should be
considered insecure. To avoid giving the password on the
command line, use an option file. See
<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>
.
</p>
<p>
To explicitly specify that there is no password and that
<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>
should not prompt for one,
use the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--skip-password
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_plugin-dir">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_plugin-dir">
<code class="option">
--plugin-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for plugin-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--plugin-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304289648">
</a>
<a class="indexterm" name="idm46045304288160">
</a>
<p>
The directory in which to look for plugins. Specify this
option if the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_default-auth">
<code class="option">
--default-auth
</code>
</a>
option is
used to specify an authentication plugin but
<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>
does not find it. See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_port">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
,
<code class="option">
-P
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for port">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--port=port_num
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
3306
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304270032">
</a>
<a class="indexterm" name="idm46045304268544">
</a>
<a class="indexterm" name="idm46045304267056">
</a>
<a class="indexterm" name="idm46045304265984">
</a>
<p>
The TCP/IP port number to use for connecting to a remote
server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_print-defaults">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045304256704">
</a>
<a class="indexterm" name="idm46045304255216">
</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_mysqlbinlog_print-table-metadata">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_print-table-metadata">
<code class="option">
--print-table-metadata
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-table-metadata">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-table-metadata
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304244400">
</a>
<a class="indexterm" name="idm46045304242896">
</a>
<p>
Print table related metadata from the binary log. Configure
the amount of table related metadata binary logged using
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_row_metadata">
<code class="literal">
binlog-row-metadata
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_protocol">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_protocol">
<code class="option">
--protocol={TCP|SOCKET|PIPE|MEMORY}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for protocol">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--protocol=type
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[see text]
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
TCP
</code>
</p>
<p class="valid-value">
<code class="literal">
SOCKET
</code>
</p>
<p class="valid-value">
<code class="literal">
PIPE
</code>
</p>
<p class="valid-value">
<code class="literal">
MEMORY
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304221536">
</a>
<a class="indexterm" name="idm46045304220048">
</a>
<p>
The transport protocol to use for connecting to the server.
It is useful when the other connection parameters normally
result in use of a protocol other than the one you want. For
details on the permissible values, see
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_raw">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for raw">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--raw
</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="idm46045304205136">
</a>
<a class="indexterm" name="idm46045304203648">
</a>
<p>
By default,
<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>
reads binary log
files and writes events in text format. The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
option tells
<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>
to write them in their
original binary format. Its use requires that
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
also be used because the files are requested from a server.
<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>
writes one output file for
each file read from the server. The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
option can be used
to make a backup of a server's binary log. With the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
option, the
backup is
<span class="quote">
“
<span class="quote">
live
</span>
”
</span>
because
<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>
stays connected to the
server. By default, output files are written in the current
directory with the same names as the original log files.
Output file names can be modified using the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_result-file">
<code class="option">
--result-file
</code>
</a>
option.
For more information, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_read-from-remote-source">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source=
<em class="replaceable">
<code>
type
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for read-from-remote-source">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--read-from-remote-source=type
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304181728">
</a>
<a class="indexterm" name="idm46045304180224">
</a>
<p>
This option reads binary logs from a MySQL server with the
<code class="literal">
COM_BINLOG_DUMP
</code>
or
<code class="literal">
COM_BINLOG_DUMP_GTID
</code>
commands by setting
the option value to either
<code class="literal">
BINLOG-DUMP-NON-GTIDS
</code>
or
<code class="literal">
BINLOG-DUMP-GTIDS
</code>
, respectively. If
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source=BINLOG-DUMP-GTIDS
</code>
</a>
is combined with
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_exclude-gtids">
<code class="option">
--exclude-gtids
</code>
</a>
,
transactions can be filtered out on the source, avoiding
unnecessary network traffic.
</p>
<p>
The connection parameter options are used with these options
or the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
option. These options are
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_host">
<code class="option">
--host
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--password
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_port">
<code class="option">
--port
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_protocol">
<code class="option">
--protocol
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_socket">
<code class="option">
--socket
</code>
</a>
, and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_user">
<code class="option">
--user
</code>
</a>
. If none of the
remote options is specified, the connection parameter
options are ignored.
</p>
<p>
The
<a class="link" href="privileges-provided.html#priv_replication-slave">
<code class="literal">
REPLICATION SLAVE
</code>
</a>
privilege is required to use these options.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_read-from-remote-master">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-master">
<code class="option">
--read-from-remote-master=
<em class="replaceable">
<code>
type
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for read-from-remote-master">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--read-from-remote-master=type
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304153616">
</a>
<a class="indexterm" name="idm46045304152112">
</a>
<p>
Deprecated synonym for
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_read-from-remote-server">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
,
<code class="option">
-R
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for read-from-remote-server">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--read-from-remote-server=file_name
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304140608">
</a>
<a class="indexterm" name="idm46045304139104">
</a>
<p>
Read the binary log from a MySQL server rather than reading
a local log file. This option requires that the remote
server be running. It works only for binary log files on the
remote server and not relay log files. This accepts the
binary log file name (including the numeric suffix) without
the file path.
</p>
<p>
The connection parameter options are used with this option
or the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source
</code>
</a>
option. These options are
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_host">
<code class="option">
--host
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_password">
<code class="option">
--password
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_port">
<code class="option">
--port
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_protocol">
<code class="option">
--protocol
</code>
</a>
,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_socket">
<code class="option">
--socket
</code>
</a>
, and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_user">
<code class="option">
--user
</code>
</a>
. If neither of
the remote options is specified, the connection parameter
options are ignored.
</p>
<p>
The
<a class="link" href="privileges-provided.html#priv_replication-slave">
<code class="literal">
REPLICATION SLAVE
</code>
</a>
privilege is required to use this option.
</p>
<p>
This option is like
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source=BINLOG-DUMP-NON-GTIDS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_result-file">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_result-file">
<code class="option">
--result-file=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
,
<code class="option">
-r
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for result-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--result-file=name
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304117504">
</a>
<a class="indexterm" name="idm46045304116016">
</a>
<p>
Without the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
option, this option indicates the file to which
<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>
writes text output. With
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
,
<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>
writes one binary output file
for each log file transferred from the server, writing them
by default in the current directory using the same names as
the original log file. In this case, the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_result-file">
<code class="option">
--result-file
</code>
</a>
option
value is treated as a prefix that modifies output file
names.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_require-row-format">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_require-row-format">
<code class="option">
--require-row-format
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for require-row-format">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--require-row-format
</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="idm46045304096112">
</a>
<a class="indexterm" name="idm46045304094608">
</a>
<p>
Require row-based binary logging format for events. This
option enforces row-based replication events for
<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>
output. The stream of events
produced with this option would be accepted by a replication
channel that is secured using the
<code class="literal">
REQUIRE_ROW_FORMAT
</code>
option of 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.
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=ROW
</code>
</a>
must be
set on the server where the binary log was written. When you
specify this option,
<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>
stops
with an error message if it encounters any events that are
disallowed under the
<code class="literal">
REQUIRE_ROW_FORMAT
</code>
restrictions, including
<code class="literal">
LOAD DATA INFILE
</code>
instructions, creating or dropping temporary tables,
<code class="literal">
INTVAR
</code>
,
<code class="literal">
RAND
</code>
, or
<code class="literal">
USER_VAR
</code>
events, and non-row-based events
within a DML transaction.
<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>
also prints a
<code class="literal">
SET
@@session.require_row_format
</code>
statement at the
start of its output to apply the restrictions when the
output is executed, and does not print the
<code class="literal">
SET
@@session.pseudo_thread_id
</code>
statement.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_rewrite-db">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_rewrite-db">
<code class="option">
--rewrite-db='
<em class="replaceable">
<code>
from_name
</code>
</em>
->
<em class="replaceable">
<code>
to_name
</code>
</em>
'
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for rewrite-db">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--rewrite-db='oldname->newname'
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304066800">
</a>
<a class="indexterm" name="idm46045304065312">
</a>
<p>
When reading from a row-based or statement-based log,
rewrite all occurrences of
<em class="replaceable">
<code>
from_name
</code>
</em>
to
<em class="replaceable">
<code>
to_name
</code>
</em>
. Rewriting is done on the
rows, for row-based logs, as well as on the
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
clauses, for
statement-based logs.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Statements in which table names are qualified with
database names are not rewritten to use the new name when
using this option.
</p>
</div>
<p>
The rewrite rule employed as a value for this option is a
string having the form
<code class="literal">
'
<em class="replaceable">
<code>
from_name
</code>
</em>
->
<em class="replaceable">
<code>
to_name
</code>
</em>
'
</code>
,
as shown previously, and for this reason must be enclosed by
quotation marks.
</p>
<p>
To employ multiple rewrite rules, specify the option
multiple times, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa36536909"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token constant">--rewrite-db</span>=<span class="token atrule">'dbcurrent->dbold'</span> <span class="token constant">--rewrite-db</span>=<span class="token atrule">'dbtest->dbcurrent'</span> \
binlog<span class="token punctuation">.</span>00001 > /tmp/statements<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
When used together with the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_database">
<code class="option">
--database
</code>
</a>
option, the
<code class="option">
--rewrite-db
</code>
option is applied first; then
<code class="option">
--database
</code>
option is applied, using the
rewritten database name. The order in which the options are
provided makes no difference in this regard.
</p>
<p>
This means that, for example, if
<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>
is started with
<code class="option">
--rewrite-db='mydb->yourdb'
--database=yourdb
</code>
, then all updates to any tables
in databases
<code class="literal">
mydb
</code>
and
<code class="literal">
yourdb
</code>
are included in the output. On the
other hand, if it is started with
<code class="option">
--rewrite-db='mydb->yourdb'
--database=mydb
</code>
, then
<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>
outputs no statements at all:
since all updates to
<code class="literal">
mydb
</code>
are first
rewritten as updates to
<code class="literal">
yourdb
</code>
before
applying the
<code class="option">
--database
</code>
option, there
remain no updates that match
<code class="option">
--database=mydb
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_server-id">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-id">
<code class="option">
--server-id=
<em class="replaceable">
<code>
id
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for server-id">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--server-id=id
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304035600">
</a>
<a class="indexterm" name="idm46045304034112">
</a>
<p>
Display only those events created by the server having the
given server ID.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_server-id-bits">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-id-bits">
<code class="option">
--server-id-bits=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for server-id-bits">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--server-id-bits=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
32
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
7
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
32
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045304014864">
</a>
<a class="indexterm" name="idm46045304013376">
</a>
<p>
Use only the first
<em class="replaceable">
<code>
N
</code>
</em>
bits of the
<a class="link" href="replication-options.html#sysvar_server_id">
<code class="literal">
server_id
</code>
</a>
to identify the
server. If the binary log was written by a
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with server-id-bits set to less
than 32 and user data stored in the most significant bit,
running
<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>
with
<code class="option">
--server-id-bits
</code>
set to 32 enables this
data to be seen.
</p>
<p>
This option is supported only by the version of
<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>
supplied with the NDB Cluster
distribution, or built with NDB Cluster support.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_server-public-key-path">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for server-public-key-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--server-public-key-path=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303994720">
</a>
<a class="indexterm" name="idm46045303993216">
</a>
<p>
The path name to a file in PEM format containing a
client-side copy of the public key required by the server
for RSA key pair-based password exchange. This option
applies to clients that authenticate with the
<code class="literal">
sha256_password
</code>
(deprecated) or
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. This option is ignored for accounts that do not
authenticate with one of those plugins. It is also ignored
if RSA-based password exchange is not used, as is the case
when the client connects to the server using a secure
connection.
</p>
<p>
If
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
For
<code class="literal">
sha256_password
</code>
(deprecated), this
option applies only if MySQL was built using OpenSSL.
</p>
<p>
For information about the
<code class="literal">
sha256_password
</code>
and
<code class="literal">
caching_sha2_password
</code>
plugins, see
<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>
, and
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_set-charset">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_set-charset">
<code class="option">
--set-charset=
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for set-charset">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--set-charset=charset_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303971888">
</a>
<a class="indexterm" name="idm46045303970400">
</a>
<p>
Add a
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET NAMES
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
</a>
statement
to the output to specify the character set to be used for
processing log files.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_shared-memory-base-name">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_shared-memory-base-name">
<code class="option">
--shared-memory-base-name=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for shared-memory-base-name">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--shared-memory-base-name=name
</code>
</td>
</tr>
<tr>
<th>
Platform Specific
</th>
<td>
Windows
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303956720">
</a>
<a class="indexterm" name="idm46045303955216">
</a>
<p>
On Windows, the shared-memory name to use for connections
made using shared memory to a local server. The default
value is
<code class="literal">
MYSQL
</code>
. The shared-memory name is
case-sensitive.
</p>
<p>
This option applies only if the server was started with the
<a class="link" href="server-system-variables.html#sysvar_shared_memory">
<code class="literal">
shared_memory
</code>
</a>
system
variable enabled to support shared-memory connections.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_short-form">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_short-form">
<code class="option">
--short-form
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for short-form">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--short-form
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303942608">
</a>
<a class="indexterm" name="idm46045303941120">
</a>
<p>
Display only the statements contained in the log, without
any extra information or row-based events. This is for
testing only, and should not be used in production systems.
It is deprecated, and you should expect it to be removed in
a future release.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_skip-gtids">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_skip-gtids">
<code class="option">
--skip-gtids[=(true|false)]
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-gtids">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-gtids[=true|false]
</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="idm46045303926672">
</a>
<a class="indexterm" name="idm46045303925184">
</a>
<p>
Do not include the GTIDs from the binary log files in the
output dump file. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23782039"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token property">--skip-gtids</span> binlog<span class="token punctuation">.</span>000001 > /tmp/dump<span class="token punctuation">.</span>sql
mysql <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-e</span> <span class="token atrule">"source /tmp/dump.sql"</span></code></pre>
</div>
<p>
You should not normally use this option in production or in
recovery, except in the specific, and rare, scenarios where
the GTIDs are actively unwanted. For example, an
administrator might want to duplicate selected transactions
(such as table definitions) from a deployment to another,
unrelated, deployment that will not replicate to or from the
original. In that scenario,
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_skip-gtids">
<code class="option">
--skip-gtids
</code>
</a>
can be used to enable the administrator to apply the
transactions as if they were new, and ensure that the
deployments remain unrelated. However, you should only use
this option if the inclusion of the GTIDs causes a known
issue for your use case.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_socket">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_socket">
<code class="option">
--socket=
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</a>
,
<code class="option">
-S
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for socket">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--socket={file_name|pipe_name}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303909008">
</a>
<a class="indexterm" name="idm46045303907520">
</a>
<p>
For connections to
<code class="literal">
localhost
</code>
, the Unix
socket file to use, or, on Windows, the name of the named
pipe to use.
</p>
<p>
On Windows, this option applies only if the server was
started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable enabled to support named-pipe connections.
In addition, the user making the connection must be a member
of the Windows group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_ssl">
</a>
<code class="option">
--ssl*
</code>
</p>
<a class="indexterm" name="idm46045303900000">
</a>
<a class="indexterm" name="idm46045303898512">
</a>
<p>
Options that begin with
<code class="option">
--ssl
</code>
specify
whether to connect to the server using encryption and
indicate where to find SSL keys and certificates. See
<a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
Command Options for Encrypted Connections
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_ssl-fips-mode">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
<code class="option">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-fips-mode">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
OFF
</code>
</p>
<p class="valid-value">
<code class="literal">
ON
</code>
</p>
<p class="valid-value">
<code class="literal">
STRICT
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303876432">
</a>
<a class="indexterm" name="idm46045303874944">
</a>
<p>
Controls whether to enable FIPS mode on the client side. The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
option
differs from other
<code class="option">
--ssl-
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
options in that it is not used to establish encrypted
connections, but rather to affect which cryptographic
operations to permit. See
<a class="xref" href="fips-mode.html" title="8.8 FIPS Support">
Section 8.8, “FIPS Support”
</a>
.
</p>
<p>
These
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
values are permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
OFF
</code>
: Disable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ON
</code>
: Enable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STRICT
</code>
: Enable
<span class="quote">
“
<span class="quote">
strict
</span>
”
</span>
FIPS mode.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the OpenSSL FIPS Object Module is not available, the
only permitted value for
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
is
<code class="literal">
OFF
</code>
. In this case, setting
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
to
<code class="literal">
ON
</code>
or
<code class="literal">
STRICT
</code>
causes
the client to produce a warning at startup and to operate
in non-FIPS mode.
</p>
</div>
<p>
This option is deprecated. Expect it to be removed in a
future version of MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_start-datetime">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-datetime">
<code class="option">
--start-datetime=
<em class="replaceable">
<code>
datetime
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for start-datetime">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--start-datetime=datetime
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Datetime
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303847984">
</a>
<a class="indexterm" name="idm46045303846496">
</a>
<p>
Start reading the binary log at the first event having a
timestamp equal to or later than the
<em class="replaceable">
<code>
datetime
</code>
</em>
argument. The
<em class="replaceable">
<code>
datetime
</code>
</em>
value is relative to the
local time zone on the machine where you run
<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>
. The value should be in a
format accepted for the
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
data types. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa36461082"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token constant">--start-datetime</span>=<span class="token atrule">"2005-12-25 11:25:56"</span> binlog<span class="token punctuation">.</span>000003</code></pre>
</div>
<p>
This option is useful for point-in-time recovery. See
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_start-position">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-position">
<code class="option">
--start-position=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
,
<code class="option">
-j
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for start-position">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--start-position=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303826848">
</a>
<a class="indexterm" name="idm46045303825360">
</a>
<p>
Start decoding the binary log at the log position
<em class="replaceable">
<code>
N
</code>
</em>
, including in the output any
events that begin at position
<em class="replaceable">
<code>
N
</code>
</em>
or after. The position is a byte point in the log file, not
an event counter; it needs to point to the starting position
of an event to generate useful output. This option applies
to the first log file named on the command line.
</p>
<p>
The maximum value supported for this option is
18446744073709551616 (2
<sup>
64
</sup>
-1),
unless
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
or
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source">
<code class="option">
--read-from-remote-source
</code>
</a>
is also used, in which case the maximum is 4294967295.
</p>
<p>
This option is useful for point-in-time recovery. See
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_stop-datetime">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-datetime">
<code class="option">
--stop-datetime=
<em class="replaceable">
<code>
datetime
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for stop-datetime">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--stop-datetime=datetime
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303810032">
</a>
<a class="indexterm" name="idm46045303808544">
</a>
<p>
Stop reading the binary log at the first event having a
timestamp equal to or later than the
<em class="replaceable">
<code>
datetime
</code>
</em>
argument. See the
description of the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-datetime">
<code class="option">
--start-datetime
</code>
</a>
option
for information about the
<em class="replaceable">
<code>
datetime
</code>
</em>
value.
</p>
<p>
This option is useful for point-in-time recovery. See
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_stop-never">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for stop-never">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--stop-never
</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="idm46045303791248">
</a>
<a class="indexterm" name="idm46045303789760">
</a>
<p>
This option is used with
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
.
It tells
<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>
to remain connected
to the server. Otherwise
<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>
exits when the last log file has been transferred from the
server.
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
implies
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_to-last-log">
<code class="option">
--to-last-log
</code>
</a>
,
so only the first log file to transfer need be named on the
command line.
</p>
<p>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
is commonly
used with
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
to make
a live binary log backup, but also can be used without
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_raw">
<code class="option">
--raw
</code>
</a>
to maintain a
continuous text display of log events as the server
generates them.
</p>
<p>
With
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never">
<code class="option">
--stop-never
</code>
</a>
, by
default,
<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>
reports a server ID
of 1 when it connects to the server. Use
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
<code class="option">
--connection-server-id
</code>
</a>
to explicitly specify an alternative ID to report. It can be
used to avoid a conflict with the ID of a replica server or
another
<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>
process. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_stop-never-slave-server-id">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-never-slave-server-id">
<code class="option">
--stop-never-slave-server-id=
<em class="replaceable">
<code>
id
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for stop-never-slave-server-id">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--stop-never-slave-server-id=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
65535
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303757856">
</a>
<a class="indexterm" name="idm46045303756352">
</a>
<p>
This option is deprecated; expect it to be removed in a
future release. Use the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_connection-server-id">
<code class="option">
--connection-server-id
</code>
</a>
option instead to specify a server ID for
<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>
to report.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_stop-position">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-position">
<code class="option">
--stop-position=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for stop-position">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--stop-position=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303742048">
</a>
<a class="indexterm" name="idm46045303740560">
</a>
<p>
Stop decoding the binary log at the log position
<em class="replaceable">
<code>
N
</code>
</em>
, excluding from the output any
events that begin at position
<em class="replaceable">
<code>
N
</code>
</em>
or after. The position is a byte point in the log file, not
an event counter; it needs to point to a spot after the
starting position of the last event you want to include in
the output. The event starting before position
<em class="replaceable">
<code>
N
</code>
</em>
and finishing at or after the
position is the last event to be processed. This option
applies to the last log file named on the command line.
</p>
<p>
This option is useful for point-in-time recovery. See
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_tls-ciphersuites">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-ciphersuites">
<code class="option">
--tls-ciphersuites=
<em class="replaceable">
<code>
ciphersuite_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-ciphersuites">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-ciphersuites=ciphersuite_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303725696">
</a>
<a class="indexterm" name="idm46045303724208">
</a>
<p>
The permissible ciphersuites for encrypted connections that
use TLSv1.3. The value is a list of one or more
colon-separated ciphersuite names. The ciphersuites that can
be named for this option depend on the SSL library used to
compile MySQL. For details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_tls-sni-servername">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-sni-servername">
<code class="option">
--tls-sni-servername=
<em class="replaceable">
<code>
server_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-sni-servername">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-sni-servername=server_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303711280">
</a>
<a class="indexterm" name="idm46045303709776">
</a>
<p>
When specified, the name is passed to the
<code class="literal">
libmysqlclient
</code>
C API library using the
<code class="literal">
MYSQL_OPT_TLS_SNI_SERVERNAME
</code>
option of
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
. The server
name is not case-sensitive. To show which server name the
client specified for the current session, if any, check the
<a class="link" href="server-status-variables.html#statvar_Tls_sni_server_name">
<code class="literal">
Tls_sni_server_name
</code>
</a>
status
variable.
</p>
<p>
Server Name Indication (SNI) is an extension to the TLS
protocol (OpenSSL must be compiled using TLS extensions for
this option to function). The MySQL implementation of SNI
represents the client-side only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_tls-version">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_tls-version">
<code class="option">
--tls-version=
<em class="replaceable">
<code>
protocol_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-version=protocol_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
</code>
(OpenSSL 1.1.1 or higher)
</p>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2
</code>
(otherwise)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303688896">
</a>
<a class="indexterm" name="idm46045303687408">
</a>
<p>
The permissible TLS protocols for encrypted connections. The
value is a list of one or more comma-separated protocol
names. The protocols that can be named for this option
depend on the SSL library used to compile MySQL. For
details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_to-last-log">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_to-last-log">
<code class="option">
--to-last-log
</code>
</a>
,
<code class="option">
-t
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for to-last-log">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--to-last-log
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303676448">
</a>
<a class="indexterm" name="idm46045303674960">
</a>
<p>
Do not stop at the end of the requested binary log from a
MySQL server, but rather continue printing until the end of
the last binary log. If you send the output to the same
MySQL server, this may lead to an endless loop. This option
requires
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server">
<code class="option">
--read-from-remote-server
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_user">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_user">
<code class="option">
--user=
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</a>
,
<code class="option">
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for user">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--user=user_name,
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303661040">
</a>
<a class="indexterm" name="idm46045303659552">
</a>
<p>
The user name of the MySQL account to use when connecting to
a remote server.
</p>
<p>
If you are using the
<code class="literal">
Rewriter
</code>
plugin, you
should grant this user the
<a class="link" href="privileges-provided.html#priv_skip-query-rewrite">
<code class="literal">
SKIP_QUERY_REWRITE
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_verbose">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045303647024">
</a>
<a class="indexterm" name="idm46045303645536">
</a>
<p>
Reconstruct row events and display them as commented SQL
statements, with table partition information where
applicable. If this option is given twice (by passing in
either "-vv" or "--verbose --verbose"), the output includes
comments to indicate column data types and some metadata,
and informational log events such as row query log events if
the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_rows_query_log_events">
<code class="literal">
binlog_rows_query_log_events
</code>
</a>
system variable is set to
<code class="literal">
TRUE
</code>
.
</p>
<p>
For examples that show the effect of
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_base64-output">
<code class="option">
--base64-output
</code>
</a>
and
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
<code class="option">
--verbose
</code>
</a>
on row event
output, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_verify-binlog-checksum">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verify-binlog-checksum">
<code class="option">
--verify-binlog-checksum
</code>
</a>
,
<code class="option">
-c
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for verify-binlog-checksum">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--verify-binlog-checksum
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303629696">
</a>
<a class="indexterm" name="idm46045303628192">
</a>
<p>
Verify checksums in binary log files.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_version">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_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="idm46045303618192">
</a>
<a class="indexterm" name="idm46045303616704">
</a>
<p>
Display version information and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlbinlog_zstd-compression-level">
</a>
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_zstd-compression-level">
<code class="option">
--zstd-compression-level=
<em class="replaceable">
<code>
level
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for zstd-compression-level">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--zstd-compression-level=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045303604656">
</a>
<a class="indexterm" name="idm46045303603152">
</a>
<p>
The compression level to use for connections to the server
that use the
<code class="literal">
zstd
</code>
compression algorithm.
The permitted levels are from 1 to 22, with larger values
indicating increasing levels of compression. The default
<code class="literal">
zstd
</code>
compression level is 3. The
compression level setting has no effect on connections that
do not use
<code class="literal">
zstd
</code>
compression.
</p>
<p>
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>
</li>
</ul>
</div>
<p>
You can pipe the output of
<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>
into
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 to execute the events
contained in the binary log. This technique is used to recover
from an unexpected exit when you have an old backup (see
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
). For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa49954988"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000001 | mysql <span class="token property">-u</span> root <span class="token property">-p</span></code></pre>
</div>
<p>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa73286005"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span><span class="token punctuation">[</span>0-9<span class="token punctuation">]</span>* | mysql <span class="token property">-u</span> root <span class="token property">-p</span></code></pre>
</div>
<p>
If the statements produced by
<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>
may
contain
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
values, these may
cause problems when
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
processes them. In
this case, 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_binary-mode">
<code class="option">
--binary-mode
</code>
</a>
option.
</p>
<p>
You can also redirect the output of
<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>
to a text file instead, if you
need to modify the statement log first (for example, to remove
statements that you do not want to execute for some reason).
After editing the file, execute the statements that it contains
by using it as input to 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>
program:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa48229751"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000001 > tmpfile
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <em class="replaceable">edit tmpfile</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
mysql <span class="token property">-u</span> root <span class="token property">-p</span> < tmpfile</code></pre>
</div>
<p>
When
<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>
is invoked with the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_start-position">
<code class="option">
--start-position
</code>
</a>
option, it
displays only those events with an offset in the binary log
greater than or equal to a given position (the given position
must match the start of one event). It also has options to stop
and start when it sees an event with a given date and time. This
enables you to perform point-in-time recovery using the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_stop-datetime">
<code class="option">
--stop-datetime
</code>
</a>
option (to
be able to say, for example,
<span class="quote">
“
<span class="quote">
roll forward my databases to
how they were today at 10:30 a.m.
</span>
”
</span>
).
</p>
<p>
<b>
Processing multiple files.
</b>
If you have more than one binary log to execute on the MySQL
server, the safe method is to process them all using a single
connection to the server. Here is an example that demonstrates
what may be
<span class="emphasis">
<em>
unsafe
</em>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa55750589"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000001 | mysql <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token comment" spellcheck="true"># DANGER!!</span>
mysqlbinlog binlog<span class="token punctuation">.</span>000002 | mysql <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token comment" spellcheck="true"># DANGER!!</span></code></pre>
</div>
<p>
Processing binary logs this way using multiple connections to
the server causes problems if the first log file contains a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TEMPORARY
TABLE
</code>
</a>
statement and the second log contains a
statement that uses the temporary table. When the first
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
process terminates, the server drops
the temporary table. When the second
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
process attempts to use the table, the server reports
<span class="quote">
“
<span class="quote">
unknown table.
</span>
”
</span>
</p>
<p>
To avoid problems like this, use a
<span class="emphasis">
<em>
single
</em>
</span>
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
process to execute the contents of all
binary logs that you want to process. Here is one way to do so:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa56341165"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000001 binlog<span class="token punctuation">.</span>000002 | mysql <span class="token property">-u</span> root <span class="token property">-p</span></code></pre>
</div>
<p>
Another approach is to write all the logs to a single file and
then process the file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa59553034"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog binlog<span class="token punctuation">.</span>000001 > /tmp/statements<span class="token punctuation">.</span>sql
mysqlbinlog binlog<span class="token punctuation">.</span>000002 >> /tmp/statements<span class="token punctuation">.</span>sql
mysql <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">-e</span> <span class="token atrule">"source /tmp/statements.sql"</span></code></pre>
</div>
<p>
You can also supply multiple binary log files to
<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>
as streamed input using a shell
pipe. An archive of compressed binary log files can be
decompressed and provided directly to
<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>
. In this example,
<code class="filename">
binlog-files_1.gz
</code>
contains multiple binary
log files for processing. The pipeline extracts the contents of
<code class="filename">
binlog-files_1.gz
</code>
, pipes the binary log
files to
<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>
as standard input, and
pipes the output of
<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>
into 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 execution:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa12662044"><div class="copy-help left">Press ⌘+C to 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">gzip <span class="token property">-cd</span> binlog-files_1<span class="token punctuation">.</span>gz | <span class="token punctuation">.</span>/mysqlbinlog - | <span class="token punctuation">.</span>/mysql <span class="token property">-uroot</span> <span class="token property">-p</span></code></pre>
</div>
<p>
You can specify more than one archive file, for example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa74917401"><div class="copy-help left">Press ⌘+C to 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">gzip <span class="token property">-cd</span> binlog-files_1<span class="token punctuation">.</span>gz binlog-files_2<span class="token punctuation">.</span>gz | <span class="token punctuation">.</span>/mysqlbinlog - | <span class="token punctuation">.</span>/mysql <span class="token property">-uroot</span> <span class="token property">-p</span></code></pre>
</div>
<p>
For streamed input, do not use
<code class="literal">
--stop-position
</code>
, because
<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>
cannot identify the last log file
to apply this option.
</p>
<p>
<b>
LOAD DATA operations.
</b>
<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>
can produce output that
reproduces a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
operation without the original data file.
<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>
copies the data to a temporary
file and writes a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statement that refers to the file. The default
location of the directory where these files are written is
system-specific. To specify a directory explicitly, use the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load
</code>
</a>
option.
</p>
<p>
Because
<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>
converts
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statements to
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statements (that is, it adds
<code class="literal">
LOCAL
</code>
), both the client and the server that
you use to process the statements must be configured with the
<code class="literal">
LOCAL
</code>
capability enabled. See
<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>
.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
The temporary files created for
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statements are
<span class="emphasis">
<em>
not
</em>
</span>
automatically deleted because they are needed until you
actually execute those statements. You should delete the
temporary files yourself after you no longer need the
statement log. The files can be found in the temporary file
directory and have names like
<em class="replaceable">
<code>
original_file_name-#-#
</code>
</em>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-online-upgrade-methods.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-online-upgrade-methods">
</a>
20.8.3.3 Group Replication Online Upgrade Methods
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045131570096">
</a>
<p>
Choose one of the following methods of upgrading a Group
Replication group:
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-upgrading-rolling-in-group">
</a>
Rolling In-Group Upgrade
</h5>
</div>
</div>
</div>
<p>
This method is supported provided that servers running a newer
version are not generating workload to the group while there
are still servers with an older version in it. In other words
servers with a newer version can join the group only as
secondaries. In this method there is only ever one group, and
each server instance is removed from the group, upgraded and
then rejoined to the group.
</p>
<p>
This method is well suited to single-primary groups. When the
group is operating in single-primary mode, if you require the
primary to remain the same throughout (except when it is being
upgraded itself), it should be the last member to be upgraded.
The primary cannot remain as the primary unless it is running
the lowest MySQL Server version in the group. After the
primary has been upgraded, you can use the
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
function to reappoint it as the primary. If you do not mind
which member is the primary, the members can be upgraded in
any order. The group elects a new primary whenever necessary
from among the members running the lowest MySQL Server
version, following 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>
.
</p>
<p>
For groups operating in multi-primary mode, during a rolling
in-group upgrade the number of primaries is decreased, causing
a reduction in write availability. This is because if a member
joins a group when it is running a higher MySQL Server version
than the lowest version that the existing group members are
running, it automatically remains in read-only mode
(
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only=ON
</code>
</a>
).
</p>
<p>
For full information on version compatibility in a group and
how this influences the behavior of a group during an upgrade
process, 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>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-upgrading-rolling-migration">
</a>
Rolling Migration Upgrade
</h5>
</div>
</div>
</div>
<p>
In this method you remove members from the group, upgrade them
and then create a second group using the upgraded members. For
groups operating in multi-primary mode, during this process
the number of primaries is decreased, causing a reduction in
write availability. This does not impact groups operating in
single-primary mode.
</p>
<p>
Because the group running the older version is online while
you are upgrading the members, you need the group running the
newer version to catch up with any transactions executed while
the members were being upgraded. Therefore one of the servers
in the new group is configured as a replica of a primary from
the older group. This ensures that the new group catches up
with the older group. Because this method relies on an
asynchronous replication channel which is used to replicate
data from one group to another, it is supported under the same
assumptions and requirements of asynchronous source-replica
replication, see
<a class="xref" href="replication.html" title="Chapter 19 Replication">
Chapter 19,
<i>
Replication
</i>
</a>
. For groups
operating in single-primary mode, the asynchronous replication
connection to the old group must send data to the primary in
the new group, for a multi-primary group the asynchronous
replication channel can connect to any primary.
</p>
<p>
The process is to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
remove members from the original group running the older
server version one by one, see
<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>
</p>
</li>
<li class="listitem">
<p>
upgrade the server version running on the member, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
. You can either follow an
in-place or provision approach to upgrading.
</p>
</li>
<li class="listitem">
<p>
create a new group with the upgraded members, see
<a class="xref" href="group-replication.html" title="Chapter 20 Group Replication">
Chapter 20,
<i>
Group Replication
</i>
</a>
. In this case you need
to configure a new group name on each member (because the
old group is still running and using the old name),
bootstrap an initial upgraded member, and then add the
remaining upgraded members.
</p>
</li>
<li class="listitem">
<p>
set up an asynchronous replication channel between the old
group and the new group, see
<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>
. Configure the
older primary to function as the asynchronous replication
source server and the new group member as a GTID-based
replica.
</p>
</li>
</ul>
</div>
<p>
Before you can redirect your application to the new group, you
must ensure that the new group has a suitable number of
members, for example so that the group can handle the failure
of a member. Issue
<code class="literal">
SELECT * FROM
performance_schema.replication_group_members
</code>
and
compare the initial group size and the new group size. Wait
until all data from the old group is propagated to the new
group and then drop the asynchronous replication connection
and upgrade any missing members.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="group-replication-upgrading-rolling-duplication">
</a>
Rolling Duplication Upgrade
</h5>
</div>
</div>
</div>
<p>
In this method you create a second group consisting of members
which are running the newer version, and the data missing from
the older group is replicated to the newer group. This assumes
that you have enough servers to run both groups
simultaneously. Due to the fact that during this process the
number of primaries is
<span class="emphasis">
<em>
not
</em>
</span>
decreased, for
groups operating in multi-primary mode there is no reduction
in write availability. This makes rolling duplication upgrade
well suited to groups operating in multi-primary mode. This
does not impact groups operating in single-primary mode.
</p>
<p>
Because the group running the older version is online while
you are provisioning the members in the new group, you need
the group running the newer version to catch up with any
transactions executed while the members were being
provisioned. Therefore one of the servers in the new group is
configured as a replica of a primary from the older group.
This ensures that the new group catches up with the older
group. Because this method relies on an asynchronous
replication channel which is used to replicate data from one
group to another, it is supported under the same assumptions
and requirements of asynchronous source-replica replication,
see
<a class="xref" href="replication.html" title="Chapter 19 Replication">
Chapter 19,
<i>
Replication
</i>
</a>
. For groups operating in
single-primary mode, the asynchronous replication connection
to the old group must send data to the primary in the new
group, for a multi-primary group the asynchronous replication
channel can connect to any primary.
</p>
<p>
The process is to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
deploy a suitable number of members so that the group
running the newer version can handle failure of a member
</p>
</li>
<li class="listitem">
<p>
take a backup of the existing data from a member of the
group
</p>
</li>
<li class="listitem">
<p>
use the backup from the older member to provision the
members of the new group, see
<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>
for one method.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You must restore the backup to the same version of MySQL
which the backup was taken from, and then perform an
in-place upgrade. For instructions, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
create a new group with the upgraded members, see
<a class="xref" href="group-replication.html" title="Chapter 20 Group Replication">
Chapter 20,
<i>
Group Replication
</i>
</a>
. In this case you need
to configure a new group name on each member (because the
old group is still running and using the old name),
bootstrap an initial upgraded member, and then add the
remaining upgraded members.
</p>
</li>
<li class="listitem">
<p>
set up an asynchronous replication channel between the old
group and the new group, see
<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>
. Configure the
older primary to function as the asynchronous replication
source server and the new group member as a GTID-based
replica.
</p>
</li>
</ul>
</div>
<p>
Once the ongoing data missing from the newer group is small
enough to be quickly transferred, you must redirect write
operations to the new group. Wait until all data from the old
group is propagated to the new group and then drop the
asynchronous replication connection.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-size-pl.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-size-pl">
</a>
25.5.29 ndb_size.pl — NDBCLUSTER Size Requirement Estimator
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045095969904">
</a>
<p>
This is a Perl script that can be used to estimate the amount of
space that would be required by a MySQL database if it were
converted to use the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine. Unlike the other utilities discussed in this
section, it does not require access to an NDB Cluster (in fact,
there is no reason for it to do so). However, it does need to
access the MySQL server on which the database to be tested
resides.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="mysql-cluster-programs-ndb-size-pl.html" title="25.5.29 ndb_size.pl — NDBCLUSTER Size Requirement Estimator">
<span class="command">
<strong>
ndb_size.pl
</strong>
</span>
</a>
is deprecated, and no longer
supported, in NDB 8.4.3 and later. You should expect it to be
removed from a future version of the NDB Cluster distribution,
and modify any dependent applications accordingly.
</p>
</div>
<h4>
<a name="idm46045095964480">
</a>
Requirements
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A running MySQL server. The server instance does not have to
provide support for NDB Cluster.
</p>
</li>
<li class="listitem">
<p>
A working installation of Perl.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
DBI
</code>
module, which can be obtained
from CPAN if it is not already part of your Perl
installation. (Many Linux and other operating system
distributions provide their own packages for this library.)
</p>
</li>
<li class="listitem">
<p>
A MySQL user account having the necessary privileges. If you
do not wish to use an existing account, then creating one
using
<code class="literal">
GRANT USAGE ON
<em class="replaceable">
<code>
db_name
</code>
</em>
.*
</code>
—where
<em class="replaceable">
<code>
db_name
</code>
</em>
is the name of the
database to be examined—is sufficient for this
purpose.
</p>
</li>
</ul>
</div>
<p>
<code class="filename">
ndb_size.pl
</code>
can also be found in the MySQL
sources in
<code class="filename">
storage/ndb/tools
</code>
.
</p>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-size-pl.html" title="25.5.29 ndb_size.pl — NDBCLUSTER Size Requirement Estimator">
<span class="command">
<strong>
ndb_size.pl
</strong>
</span>
</a>
are
shown in the following table. Additional descriptions follow the
table.
</p>
<p>
</p>
<h4>
<a name="idm46045095953072">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69576826"><div class="copy-help left">Press ⌘+C to 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">perl ndb_size<span class="token punctuation">.</span>pl <span class="token punctuation">[</span><span class="token constant">--database</span><span class="token attr-value"><span class="token punctuation">=</span>{<em class="replaceable">db_name</em>|ALL}<span class="token punctuation">]</span></span> <span class="token punctuation">[</span><span class="token constant">--hostname</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host</em>[:<em class="replaceable">port</em>]<span class="token punctuation">]</span></span> <span class="token punctuation">[</span><span class="token constant">--socket</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">socket</em><span class="token punctuation">]</span></span> \
<span class="token punctuation">[</span><span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">user</em><span class="token punctuation">]</span></span> <span class="token punctuation">[</span><span class="token constant">--password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">password</em><span class="token punctuation">]</span></span> \
<span class="token punctuation">[</span><span class="token property">--help|-h</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token constant">--format</span><span class="token attr-value"><span class="token punctuation">=</span>{html|text}<span class="token punctuation">]</span></span> \
<span class="token punctuation">[</span><span class="token constant">--loadqueries</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em><span class="token punctuation">]</span></span> <span class="token punctuation">[</span><span class="token constant">--savequeries</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em><span class="token punctuation">]</span></span></code></pre>
</div>
<p>
<a name="option_ndb_size_pl_options">
</a>
By default, this utility attempts to analyze all databases on
the server. You can specify a single database using the
<code class="option">
--database
</code>
option; the default behavior can be
made explicit by using
<code class="literal">
ALL
</code>
for the name of
the database. You can also exclude one or more databases by
using the
<code class="option">
--excludedbs
</code>
option with a
comma-separated list of the names of the databases to be
skipped. Similarly, you can cause specific tables to be skipped
by listing their names, separated by commas, following the
optional
<code class="option">
--excludetables
</code>
option. A host name
can be specified using
<code class="option">
--hostname
</code>
; the default
is
<code class="literal">
localhost
</code>
. You can specify a port in
addition to the host using
<em class="replaceable">
<code>
host
</code>
</em>
:
<em class="replaceable">
<code>
port
</code>
</em>
format for the value of
<code class="option">
--hostname
</code>
. The default
port number is 3306. If necessary, you can also specify a
socket; the default is
<code class="filename">
/var/lib/mysql.sock
</code>
.
A MySQL user name and password can be specified the
corresponding options shown. It also possible to control the
format of the output using the
<code class="option">
--format
</code>
option;
this can take either of the values
<code class="literal">
html
</code>
or
<code class="literal">
text
</code>
, with
<code class="literal">
text
</code>
being the
default. An example of the text output is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83617553"><div class="copy-help left">Press ⌘+C to 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_size.pl</span> <span class="token constant">--database</span><span class="token attr-value"><span class="token punctuation">=</span>test</span> <span class="token constant">--socket</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/mysql.sock</span>
ndb_size<span class="token punctuation">.</span>pl report for database<span class="token punctuation">:</span> <span class="token atrule">'test'</span> <span class="token punctuation">(</span>1 tables<span class="token punctuation">)</span>
<span class="token property">--------------------------------------------------</span>
Connected to<span class="token punctuation">:</span> DBI<span class="token punctuation">:</span>mysql<span class="token punctuation">:</span>host<span class="token attr-value"><span class="token punctuation">=</span>localhost;mysql_socket=/tmp/mysql.sock</span>
Including information for versions<span class="token punctuation">:</span> 4<span class="token punctuation">.</span>1<span class="token punctuation">,</span> 5<span class="token punctuation">.</span>0<span class="token punctuation">,</span> 5<span class="token punctuation">.</span>1
test<span class="token punctuation">.</span>t1
<span class="token property">-------</span>
DataMemory for Columns <span class="token punctuation">(</span>* means varsized DataMemory<span class="token punctuation">)</span><span class="token punctuation">:</span>
Column Name Type Varsized Key 4<span class="token punctuation">.</span>1 5<span class="token punctuation">.</span>0 5<span class="token punctuation">.</span>1
HIDDEN_NDB_PKEY bigint PRI 8 8 8
c2 varchar<span class="token punctuation">(</span>50<span class="token punctuation">)</span> Y 52 52 4*
c1 int<span class="token punctuation">(</span>11<span class="token punctuation">)</span> 4 4 4
<span class="token property">--</span> <span class="token property">--</span> <span class="token property">--</span>
Fixed Size Columns DM/Row 64 64 12
Varsize Columns DM/Row 0 0 4
DataMemory for Indexes<span class="token punctuation">:</span>
Index Name Type 4<span class="token punctuation">.</span>1 5<span class="token punctuation">.</span>0 5<span class="token punctuation">.</span>1
PRIMARY BTREE 16 16 16
<span class="token property">--</span> <span class="token property">--</span> <span class="token property">--</span>
Total Index DM/Row 16 16 16
IndexMemory for Indexes<span class="token punctuation">:</span>
Index Name 4<span class="token punctuation">.</span>1 5<span class="token punctuation">.</span>0 5<span class="token punctuation">.</span>1
PRIMARY 33 16 16
<span class="token property">--</span> <span class="token property">--</span> <span class="token property">--</span>
Indexes IM/Row 33 16 16
Summary <span class="token punctuation">(</span>for THIS table<span class="token punctuation">)</span><span class="token punctuation">:</span>
4<span class="token punctuation">.</span>1 5<span class="token punctuation">.</span>0 5<span class="token punctuation">.</span>1
Fixed Overhead DM/Row 12 12 16
NULL Bytes/Row 4 4 4
DataMemory/Row 96 96 48
<span class="token punctuation">(</span>Includes overhead<span class="token punctuation">,</span> bitmap and indexes<span class="token punctuation">)</span>
Varsize Overhead DM/Row 0 0 8
Varsize NULL Bytes/Row 0 0 4
Avg Varside DM/Row 0 0 16
No<span class="token punctuation">.</span> Rows 0 0 0
Rows/32kb DM Page 340 340 680
Fixedsize DataMemory <span class="token punctuation">(</span>KB<span class="token punctuation">)</span> 0 0 0
Rows/32kb Varsize DM Page 0 0 2040
Varsize DataMemory <span class="token punctuation">(</span>KB<span class="token punctuation">)</span> 0 0 0
Rows/8kb IM Page 248 512 512
IndexMemory <span class="token punctuation">(</span>KB<span class="token punctuation">)</span> 0 0 0
Parameter Minimum Requirements
<span class="token property">------------------------------</span>
* indicates greater than default
Parameter Default 4<span class="token punctuation">.</span>1 5<span class="token punctuation">.</span>0 5<span class="token punctuation">.</span>1
DataMemory <span class="token punctuation">(</span>KB<span class="token punctuation">)</span> 81920 0 0 0
NoOfOrderedIndexes 128 1 1 1
NoOfTables 128 1 1 1
IndexMemory <span class="token punctuation">(</span>KB<span class="token punctuation">)</span> 18432 0 0 0
NoOfUniqueHashIndexes 64 0 0 0
NoOfAttributes 1000 3 3 3
NoOfTriggers 768 5 5 5</code></pre>
</div>
<p>
<a name="option_ndb_size_pl_debugging">
</a>
For debugging purposes, the Perl arrays containing the queries
run by this script can be read from the file specified using can
be saved to a file using
<code class="option">
--savequeries
</code>
; a file
containing such arrays to be read during script execution can be
specified using
<code class="option">
--loadqueries
</code>
. Neither of these
options has a default value.
</p>
<p>
<a name="option_ndb_size_pl_format">
</a>
To produce output in HTML format, use the
<code class="option">
--format
</code>
option and redirect the output to a
file, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa73873101"><div class="copy-help left">Press ⌘+C to 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_size.pl</span> <span class="token constant">--database</span><span class="token attr-value"><span class="token punctuation">=</span>test</span> <span class="token constant">--socket</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/mysql.sock</span> <span class="token constant">--format</span><span class="token attr-value"><span class="token punctuation">=</span>html</span> > ndb_size<span class="token punctuation">.</span>html</code></pre>
</div>
<p>
(Without the redirection, the output is sent to
<code class="literal">
stdout
</code>
.)
</p>
<p>
The output from this script includes the following information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Minimum values for the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftriggers">
<code class="literal">
MaxNoOfTriggers
</code>
</a>
configuration parameters required to accommodate the tables
analyzed.
</p>
</li>
<li class="listitem">
<p>
Memory requirements for all of the tables, attributes,
ordered indexes, and unique hash indexes defined in the
database.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
required
per table and table row.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-columns.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-columns">
</a>
15.7.7.6 SHOW COLUMNS Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045171072624">
</a>
<a class="indexterm" name="idm46045171069856">
</a>
<a class="indexterm" name="idm46045171068784">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5250549"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">EXTENDED</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token keyword">FULL</span><span class="token punctuation">]</span> {<span class="token keyword">COLUMNS</span> <span class="token operator">|</span> <span class="token keyword">FIELDS</span>}
{<span class="token keyword">FROM</span> <span class="token operator">|</span> <span class="token keyword">IN</span>} <em class="replaceable">tbl_name</em>
<span class="token punctuation">[</span>{<span class="token keyword">FROM</span> <span class="token operator">|</span> <span class="token keyword">IN</span>} <em class="replaceable">db_name</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">pattern</em>'</span> <span class="token operator">|</span> <span class="token keyword">WHERE</span> <em class="replaceable">expr</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
displays information
about the columns in a given table. It also works for views.
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
displays information
only for those columns for which you have some privilege.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34233700"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COLUMNS</span> <span class="token keyword">FROM</span> City<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>
<span class="token output"><span class="token punctuation">|</span> Field <span class="token punctuation">|</span> Type <span class="token punctuation">|</span> Null <span class="token punctuation">|</span> Key <span class="token punctuation">|</span> Default <span class="token punctuation">|</span> Extra <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> int(11) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> PRI <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> auto_increment <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Name <span class="token punctuation">|</span> char(35) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> CountryCode <span class="token punctuation">|</span> char(3) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> MUL <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> District <span class="token punctuation">|</span> char(20) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Population <span class="token punctuation">|</span> int(11) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
An alternative to
<code class="literal">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
FROM
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
syntax is
<em class="replaceable">
<code>
db_name.tbl_name
</code>
</em>
. These two
statements are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75209196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COLUMNS</span> <span class="token keyword">FROM</span> mytable <span class="token keyword">FROM</span> mydb<span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">COLUMNS</span> <span class="token keyword">FROM</span> mydb<span class="token punctuation">.</span>mytable<span class="token punctuation">;</span></code></pre>
</div>
<p>
The optional
<code class="literal">
EXTENDED
</code>
keyword causes the
output to include information about hidden columns that MySQL
uses internally and are not accessible by users.
</p>
<p>
The optional
<code class="literal">
FULL
</code>
keyword causes the output
to include the column collation and comments, as well as the
privileges you have for each column.
</p>
<p>
The
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
clause, if present,
indicates which column names to match. The
<code class="literal">
WHERE
</code>
clause can be given to select rows
using more general conditions, as discussed in
<a class="xref" href="extended-show.html" title="28.8 Extensions to SHOW Statements">
Section 28.8, “Extensions to SHOW Statements”
</a>
.
</p>
<p>
The data types may differ from what you expect them to be based
on a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement
because MySQL sometimes changes data types when you create or
alter a table. The conditions under which this occurs are
described in
<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>
.
</p>
<p>
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
displays the
following values for each table column:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Field
</code>
</p>
<p>
The name of the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Type
</code>
</p>
<p>
The column data type.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Collation
</code>
</p>
<p>
The collation for nonbinary string columns, or
<code class="literal">
NULL
</code>
for other columns. This value is
displayed only if you use the
<code class="literal">
FULL
</code>
keyword.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Null
</code>
</p>
<p>
The column nullability. The value is
<code class="literal">
YES
</code>
if
<code class="literal">
NULL
</code>
values can be stored in the
column,
<code class="literal">
NO
</code>
if not.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Key
</code>
</p>
<p>
Whether the column is indexed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<code class="literal">
Key
</code>
is empty, the column either is
not indexed or is indexed only as a secondary column in
a multiple-column, nonunique index.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
Key
</code>
is
<code class="literal">
PRI
</code>
, the
column is a
<code class="literal">
PRIMARY KEY
</code>
or is one of
the columns in a multiple-column
<code class="literal">
PRIMARY
KEY
</code>
.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
Key
</code>
is
<code class="literal">
UNI
</code>
, the
column is the first column of a
<code class="literal">
UNIQUE
</code>
index. (A
<code class="literal">
UNIQUE
</code>
index permits multiple
<code class="literal">
NULL
</code>
values, but you can tell whether
the column permits
<code class="literal">
NULL
</code>
by checking
the
<code class="literal">
Null
</code>
field.)
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
Key
</code>
is
<code class="literal">
MUL
</code>
, the
column is the first column of a nonunique index in which
multiple occurrences of a given value are permitted
within the column.
</p>
</li>
</ul>
</div>
<p>
If more than one of the
<code class="literal">
Key
</code>
values
applies to a given column of a table,
<code class="literal">
Key
</code>
displays the one with the highest priority, in the order
<code class="literal">
PRI
</code>
,
<code class="literal">
UNI
</code>
,
<code class="literal">
MUL
</code>
.
</p>
<p>
A
<code class="literal">
UNIQUE
</code>
index may be displayed as
<code class="literal">
PRI
</code>
if it cannot contain
<code class="literal">
NULL
</code>
values and there is no
<code class="literal">
PRIMARY KEY
</code>
in the table. A
<code class="literal">
UNIQUE
</code>
index may display as
<code class="literal">
MUL
</code>
if several columns form a composite
<code class="literal">
UNIQUE
</code>
index; although the combination of
the columns is unique, each column can still hold multiple
occurrences of a given value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Default
</code>
</p>
<p>
The default value for the column. This is
<code class="literal">
NULL
</code>
if the column has an explicit
default of
<code class="literal">
NULL
</code>
, or if the column
definition includes no
<code class="literal">
DEFAULT
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Extra
</code>
</p>
<p>
Any additional information that is available about a given
column. The value is nonempty in these cases:
</p>
<a class="indexterm" name="idm46045171000016">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
auto_increment
</code>
for columns that have
the
<code class="literal">
AUTO_INCREMENT
</code>
attribute.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
on update CURRENT_TIMESTAMP
</code>
for
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns that
have the
<code class="literal">
ON UPDATE CURRENT_TIMESTAMP
</code>
attribute.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VIRTUAL GENERATED
</code>
or
<code class="literal">
STORED
GENERATED
</code>
for generated columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFAULT_GENERATED
</code>
for columns that
have an expression default value.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
Privileges
</code>
</p>
<p>
The privileges you have for the column. This value is
displayed only if you use the
<code class="literal">
FULL
</code>
keyword.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Comment
</code>
</p>
<p>
Any comment included in the column definition. This value is
displayed only if you use the
<code class="literal">
FULL
</code>
keyword.
</p>
</li>
</ul>
</div>
<p>
Table column information is also available from 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. See
<a class="xref" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
Section 28.3.8, “The INFORMATION_SCHEMA COLUMNS Table”
</a>
. The extended
information about hidden columns is available only using
<code class="literal">
SHOW EXTENDED COLUMNS
</code>
; it cannot be obtained
from the
<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.
</p>
<p>
You can list a table's columns with the
<a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
<span class="command">
<strong>
mysqlshow
<em class="replaceable">
<code>
db_name
</code>
</em>
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</strong>
</span>
</a>
command.
</p>
<p>
The
<a class="link" href="describe.html" title="15.8.1 DESCRIBE Statement">
<code class="literal">
DESCRIBE
</code>
</a>
statement provides
information similar to
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW
COLUMNS
</code>
</a>
. See
<a class="xref" href="describe.html" title="15.8.1 DESCRIBE Statement">
Section 15.8.1, “DESCRIBE Statement”
</a>
.
</p>
<p>
The
<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>
,
<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-index.html" title="15.7.7.23 SHOW INDEX Statement">
<code class="literal">
SHOW INDEX
</code>
</a>
statements also
provide information about tables. See
<a class="xref" href="show.html" title="15.7.7 SHOW Statements">
Section 15.7.7, “SHOW Statements”
</a>
.
</p>
<p>
<code class="literal">
SHOW COLUMNS
</code>
includes the table's
generated invisible primary key, if it has one, by default. You
can cause this information to be suppressed in the
statement's output by setting
<a class="link" href="server-system-variables.html#sysvar_show_gipk_in_create_table_and_information_schema">
<code class="literal">
show_gipk_in_create_table_and_information_schema
= OFF
</code>
</a>
. For more information, see
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/problems-connecting.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="problems-connecting">
</a>
8.2.22 Troubleshooting Problems Connecting to MySQL
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045247487616">
</a>
<a class="indexterm" name="idm46045247486576">
</a>
<a class="indexterm" name="idm46045247485088">
</a>
<p>
If you encounter problems when you try to connect to the MySQL
server, the following items describe some courses of action you
can take to correct the problem.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Make sure that the server is running. If it is not, clients
cannot connect to it. For example, if an attempt to connect to
the server fails with a message such as one of those
following, one cause might be that the server is not running:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa13028401"><div class="copy-help left">Press ⌘+C to 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 output">ERROR 2003<span class="token punctuation">:</span> Can't connect to MySQL server on '<em class="replaceable">host_name</em>' (111)</span>
<span class="token prompt">$> </span><span class="token command">mysql</span>
<span class="token output">ERROR 2002<span class="token punctuation">:</span> Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (111)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
It might be that the server is running, but you are trying to
connect using a TCP/IP port, named pipe, or Unix socket file
different from the one on which the server is listening. To
correct this when you invoke a client program, specify a
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port
</code>
</a>
option to indicate the
proper port number, or a
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
option to indicate
the proper named pipe or Unix socket file. To find out where
the socket file is, you can use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa1513924"><div class="copy-help left">Press ⌘+C to 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">netstat</span> <span class="token property">-ln</span> | grep mysql</code></pre>
</div>
</li>
<li class="listitem">
<p>
Make sure that the server has not been configured to ignore
network connections or (if you are attempting to connect
remotely) that it has not been configured to listen only
locally on its network interfaces. If the server was started
with the
<a class="link" href="server-system-variables.html#sysvar_skip_networking">
<code class="literal">
skip_networking
</code>
</a>
system variable enabled, no TCP/IP connections are accepted.
If the server was started with the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system variable
set to
<code class="literal">
127.0.0.1
</code>
, it listens for TCP/IP
connections only locally on the loopback interface and does
not accept remote connections.
</p>
</li>
<li class="listitem">
<p>
Check to make sure that there is no firewall blocking access
to MySQL. Your firewall may be configured on the basis of the
application being executed, or the port number used by MySQL
for communication (3306 by default). Under Linux or Unix,
check your IP tables (or similar) configuration to ensure that
the port has not been blocked. Under Windows, applications
such as ZoneAlarm or Windows Firewall may need to be
configured not to block the MySQL port.
</p>
</li>
<li class="listitem">
<p>
The grant tables must be properly set up so that the server
can use them for access control. For some distribution types
(such as binary distributions on Windows, or RPM and DEB
distributions on Linux), the installation process initializes
the MySQL data directory, including the
<code class="literal">
mysql
</code>
system database containing the grant
tables. For distributions that do not do this, you must
initialize the data directory manually. For details, see
<a class="xref" href="postinstallation.html" title="2.9 Postinstallation Setup and Testing">
Section 2.9, “Postinstallation Setup and Testing”
</a>
.
</p>
<p>
To determine whether you need to initialize the grant tables,
look for a
<code class="filename">
mysql
</code>
directory under the data
directory. (The data directory normally is named
<code class="filename">
data
</code>
or
<code class="filename">
var
</code>
and is
located under your MySQL installation directory.) Make sure
that you have a file named
<code class="filename">
user.MYD
</code>
in
the
<code class="filename">
mysql
</code>
database directory. If not,
initialize the data directory. After doing so and starting the
server, you should be able to connect to the server.
</p>
</li>
<li class="listitem">
<p>
After a fresh installation, if you try to log on to the server
as
<code class="literal">
root
</code>
without using a password, you might
get the following error message.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa44919376"><div class="copy-help left">Press ⌘+C to 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 output">ERROR 1045 (28000)<span class="token punctuation">:</span> Access denied for user 'root'@'localhost' (using password<span class="token punctuation">:</span> NO)</span></code></pre>
</div>
<p>
It means a root password has already been assigned during
installation and it has to be supplied. See
<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>
on the different ways the
password could have been assigned and, in some cases, how to
find it. If you need to reset the root password, see
instructions in
<a class="xref" href="resetting-permissions.html" title="B.3.3.2 How to Reset the Root Password">
Section B.3.3.2, “How to Reset the Root Password”
</a>
. After
you have found or reset your password, log on again as
<code class="literal">
root
</code>
using the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
(or
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
-p
</code>
</a>
)
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa24538915"><div class="copy-help left">Press ⌘+C to 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>
Enter password<span class="token punctuation">:</span></code></pre>
</div>
<p>
However, the server is going to let you connect as
<code class="literal">
root
</code>
without using a password if you have
initialized MySQL using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
--initialize-insecure
</strong>
</span>
</a>
(see
<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>
for details).
That is a security risk, so you should set a password for the
<code class="literal">
root
</code>
account; see
<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>
for instructions.
</p>
</li>
<li class="listitem">
<p>
If you have updated an existing MySQL installation to a newer
version, did you perform the MySQL upgrade procedure? If not,
do so. The structure of the grant tables changes occasionally
when new capabilities are added, so after an upgrade you
should always make sure that your tables have the current
structure. For instructions, 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>
If a client program receives the following error message when
it tries to connect, it means that the server expects
passwords in a newer format than the client is capable of
generating:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa36526359"><div class="copy-help left">Press ⌘+C to 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>
Client does not support authentication protocol requested
by server<span class="token punctuation">;</span> consider upgrading MySQL client</code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045247441696">
</a>
<a class="indexterm" name="idm46045247440624">
</a>
<a class="indexterm" name="idm46045247439552">
</a>
<a class="indexterm" name="idm46045247438480">
</a>
<a class="indexterm" name="idm46045247437408">
</a>
Remember that client programs use connection parameters
specified in option files or environment variables. If a
client program seems to be sending incorrect default
connection parameters when you have not specified them on the
command line, check any applicable option files and your
environment. For example, if you get
<code class="literal">
Access
denied
</code>
when you run a client without any options,
make sure that you have not specified an old password in any
of your option files!
</p>
<p>
You can suppress the use of option files by a client program
by invoking it with the
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
option. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa25630822"><div class="copy-help left">Press ⌘+C to 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">mysqladmin</span> <span class="token property">--no-defaults</span> <span class="token property">-u</span> root version</code></pre>
</div>
<p>
The option files that clients use are listed in
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
. Environment variables are
listed in
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you get the following error, it means that you are using an
incorrect
<code class="literal">
root
</code>
password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa22646501"><div class="copy-help left">Press ⌘+C to 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">mysqladmin</span> <span class="token property">-u</span> root <span class="token property">-p<em class="replaceable">xxxx</em></span> ver
Access denied for user <span class="token atrule">'root'</span>@<span class="token atrule">'localhost'</span> <span class="token punctuation">(</span>using password<span class="token punctuation">:</span> YES<span class="token punctuation">)</span></code></pre>
</div>
<p>
If the preceding error occurs even when you have not specified
a password, it means that you have an incorrect password
listed in some option file. Try the
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
option as
described in the previous item.
</p>
<p>
For information on changing passwords, see
<a class="xref" href="assigning-passwords.html" title="8.2.14 Assigning Account Passwords">
Section 8.2.14, “Assigning Account Passwords”
</a>
.
</p>
<p>
If you have lost or forgotten the
<code class="literal">
root
</code>
password, see
<a class="xref" href="resetting-permissions.html" title="B.3.3.2 How to Reset the Root Password">
Section B.3.3.2, “How to Reset the Root Password”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
localhost
</code>
is a synonym for your local host
name, and is also the default host to which clients try to
connect if you specify no host explicitly.
</p>
<p>
You can use a
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host=127.0.0.1
</code>
</a>
option to name the server host explicitly. This causes a
TCP/IP connection to the local
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server. You can also use TCP/IP by specifying a
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host
</code>
</a>
option that uses the
actual host name of the local host. In this case, the host
name must be specified in a
<code class="literal">
user
</code>
table row
on the server host, even though you are running the client
program on the same host as the server.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Access denied
</code>
error message tells you
who you are trying to log in as, the client host from which
you are trying to connect, and whether you were using a
password. Normally, you should have one row in the
<code class="literal">
user
</code>
table that exactly matches the host
name and user name that were given in the error message. For
example, if you get an error message that contains
<code class="literal">
using password: NO
</code>
, it means that you tried
to log in without a password.
</p>
</li>
<li class="listitem">
<p>
If you get an
<code class="literal">
Access denied
</code>
error when
trying to connect to the database with
<code class="literal">
mysql -u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
, you may have a
problem with the
<code class="literal">
user
</code>
table. Check this by
executing
<code class="literal">
mysql -u root mysql
</code>
and issuing
this SQL statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa33604076"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <span class="token keyword">user</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The result should include a row with the
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
columns
matching your client's host name and your MySQL user name.
</p>
</li>
<li class="listitem">
<p>
If the following error occurs when you try to connect from a
host other than the one on which the MySQL server is running,
it means that there is no row in the
<code class="literal">
user
</code>
table with a
<code class="literal">
Host
</code>
value that matches the
client host:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa36499146"><div class="copy-help left">Press ⌘+C to 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">Host ... is not allowed to connect to this MySQL server</code></pre>
</div>
<p>
You can fix this by setting up an account for the combination
of client host name and user name that you are using when
trying to connect.
</p>
<p>
If you do not know the IP address or host name of the machine
from which you are connecting, you should put a row with
<code class="literal">
'%'
</code>
as the
<code class="literal">
Host
</code>
column
value in the
<code class="literal">
user
</code>
table. After trying to
connect from the client machine, use a
<code class="literal">
SELECT
USER()
</code>
query to see how you really did connect. Then
change the
<code class="literal">
'%'
</code>
in the
<code class="literal">
user
</code>
table row to the actual host name that
shows up in the log. Otherwise, your system is left insecure
because it permits connections from any host for the given
user name.
</p>
<p>
On Linux, another reason that this error might occur is that
you are using a binary MySQL version that is compiled with a
different version of the
<code class="literal">
glibc
</code>
library than
the one you are using. In this case, you should either upgrade
your operating system or
<code class="literal">
glibc
</code>
, or download
a source distribution of MySQL version and compile it
yourself. A source RPM is normally trivial to compile and
install, so this is not a big problem.
</p>
</li>
<li class="listitem">
<p>
If you specify a host name when trying to connect, but get an
error message where the host name is not shown or is an IP
address, it means that the MySQL server got an error when
trying to resolve the IP address of the client host to a name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa75392197"><div class="copy-help left">Press ⌘+C to 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">mysqladmin</span> <span class="token property">-u</span> root <span class="token property">-p<em class="replaceable">xxxx</em></span> <span class="token property">-h</span> <em class="replaceable">some_hostname</em> ver
Access denied for user <span class="token atrule">'root'</span>@<span class="token atrule">''</span> <span class="token punctuation">(</span>using password<span class="token punctuation">:</span> YES<span class="token punctuation">)</span></code></pre>
</div>
<p>
If you try to connect as
<code class="literal">
root
</code>
and get the
following error, it means that you do not have a row in the
<code class="literal">
user
</code>
table with a
<code class="literal">
User
</code>
column value of
<code class="literal">
'root'
</code>
and that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
cannot resolve the host name for
your client:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa96434277"><div class="copy-help left">Press ⌘+C to 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">Access denied for user ''@'unknown'</code></pre>
</div>
<p>
These errors indicate a DNS problem. To fix it, execute
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin flush-hosts
</strong>
</span>
</a>
to reset the
internal DNS host cache. See
<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>
.
</p>
<p>
Some permanent solutions are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Determine what is wrong with your DNS server and fix it.
</p>
</li>
<li class="listitem">
<p>
Specify IP addresses rather than host names in the MySQL
grant tables.
</p>
</li>
<li class="listitem">
<p>
Put an entry for the client machine name in
<code class="filename">
/etc/hosts
</code>
on Unix or
<code class="filename">
\windows\hosts
</code>
on Windows.
</p>
</li>
<li class="listitem">
<p>
Start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the
<a class="link" href="server-system-variables.html#sysvar_skip_name_resolve">
<code class="literal">
skip_name_resolve
</code>
</a>
system
variable enabled.
</p>
</li>
<li class="listitem">
<p>
Start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with
<a class="link" href="server-system-variables.html#sysvar_host_cache_size">
<code class="option">
--host-cache-size=0
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
On Unix, if you are running the server and the client on
the same machine, connect to
<code class="literal">
localhost
</code>
.
For connections to
<code class="literal">
localhost
</code>
, MySQL
programs attempt to connect to the local server by using a
Unix socket file, unless there are connection parameters
specified to ensure that the client makes a TCP/IP
connection. For more information, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
On Windows, if you are running the server and the client
on the same machine and the server supports named pipe
connections, connect to the host name
<code class="literal">
.
</code>
(period). Connections to
<code class="literal">
.
</code>
use a named
pipe rather than TCP/IP.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
If
<code class="literal">
mysql -u root
</code>
works but
<code class="literal">
mysql
-h
<em class="replaceable">
<code>
your_hostname
</code>
</em>
-u root
</code>
results in
<code class="literal">
Access denied
</code>
(where
<em class="replaceable">
<code>
your_hostname
</code>
</em>
is the actual host
name of the local host), you may not have the correct name for
your host in the
<code class="literal">
user
</code>
table. A common
problem here is that the
<code class="literal">
Host
</code>
value in the
<code class="literal">
user
</code>
table row specifies an unqualified
host name, but your system's name resolution routines return a
fully qualified domain name (or vice versa). For example, if
you have a row with host
<code class="literal">
'pluto'
</code>
in the
<code class="literal">
user
</code>
table, but your DNS tells MySQL that
your host name is
<code class="literal">
'pluto.example.com'
</code>
, the
row does not work. Try adding a row to the
<code class="literal">
user
</code>
table that contains the IP address of
your host as the
<code class="literal">
Host
</code>
column value.
(Alternatively, you could add a row to the
<code class="literal">
user
</code>
table with a
<code class="literal">
Host
</code>
value that contains a wildcard (for example,
<code class="literal">
'pluto.%'
</code>
). However, use of
<code class="literal">
Host
</code>
values ending with
<code class="literal">
%
</code>
is
<span class="emphasis">
<em>
insecure
</em>
</span>
and is
<span class="emphasis">
<em>
not
</em>
</span>
recommended!)
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
mysql -u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
works but
<code class="literal">
mysql -u
<em class="replaceable">
<code>
user_name
</code>
</em>
<em class="replaceable">
<code>
some_db
</code>
</em>
</code>
does not, you
have not granted access to the given user for the database
named
<em class="replaceable">
<code>
some_db
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
mysql -u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
works when
executed on the server host, but
<code class="literal">
mysql -h
<em class="replaceable">
<code>
host_name
</code>
</em>
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
does not work
when executed on a remote client host, you have not enabled
access to the server for the given user name from the remote
host.
</p>
</li>
<li class="listitem">
<p>
If you cannot figure out why you get
<code class="literal">
Access
denied
</code>
, remove from the
<code class="literal">
user
</code>
table all rows that have
<code class="literal">
Host
</code>
values
containing wildcards (rows that contain
<code class="literal">
'%'
</code>
or
<code class="literal">
'_'
</code>
characters). A very common error is
to insert a new row with
<code class="literal">
Host
</code>
=
<code class="literal">
'%'
</code>
and
<code class="literal">
User
</code>
=
<code class="literal">
'
<em class="replaceable">
<code>
some_user
</code>
</em>
'
</code>
,
thinking that this enables you to specify
<code class="literal">
localhost
</code>
to connect from the same machine.
The reason that this does not work is that the default
privileges include a row with
<code class="literal">
Host
</code>
=
<code class="literal">
'localhost'
</code>
and
<code class="literal">
User
</code>
=
<code class="literal">
''
</code>
. Because that
row has a
<code class="literal">
Host
</code>
value
<code class="literal">
'localhost'
</code>
that is more specific than
<code class="literal">
'%'
</code>
, it is used in preference to the new
row when connecting from
<code class="literal">
localhost
</code>
! The
correct procedure is to insert a second row with
<code class="literal">
Host
</code>
=
<code class="literal">
'localhost'
</code>
and
<code class="literal">
User
</code>
=
<code class="literal">
'
<em class="replaceable">
<code>
some_user
</code>
</em>
'
</code>
,
or to delete the row with
<code class="literal">
Host
</code>
=
<code class="literal">
'localhost'
</code>
and
<code class="literal">
User
</code>
=
<code class="literal">
''
</code>
. After deleting
the row, remember to issue a
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
statement to reload the grant tables. See
also
<a class="xref" href="connection-access.html" title="8.2.6 Access Control, Stage 1: Connection Verification">
Section 8.2.6, “Access Control, Stage 1: Connection Verification”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you are able to connect to the MySQL server, but get an
<code class="literal">
Access denied
</code>
message whenever you issue a
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
or
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement, your row in the
<code class="literal">
user
</code>
table does
not have the
<a class="link" href="privileges-provided.html#priv_file">
<code class="literal">
FILE
</code>
</a>
privilege
enabled.
</p>
</li>
<li class="listitem">
<p>
If you change the grant tables directly (for example, by using
<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>
, or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements) and your
changes seem to be ignored, remember that you must execute a
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH PRIVILEGES
</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-privileges
</strong>
</span>
</a>
command to
cause the server to reload the privilege tables. Otherwise,
your changes have no effect until the next time the server is
restarted. Remember that after you change the
<code class="literal">
root
</code>
password with an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statement, you do not
need to specify the new password until after you flush the
privileges, because the server does not know until then that
you have changed the password.
</p>
</li>
<li class="listitem">
<p>
If your privileges seem to have changed in the middle of a
session, it may be that a MySQL administrator has changed
them. Reloading the grant tables affects new client
connections, but it also affects existing connections as
indicated in
<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>
.
</p>
</li>
<li class="listitem">
<p>
If you have access problems with a Perl, PHP, Python, or ODBC
program, try to connect to the server with
<code class="literal">
mysql -u
<em class="replaceable">
<code>
user_name
</code>
</em>
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
or
<code class="literal">
mysql
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
-p
<em class="replaceable">
<code>
password
</code>
</em>
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
. If you are able
to connect 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, the
problem lies with your program, not with the access
privileges. (There is no space between
<code class="option">
-p
</code>
and
the password; you can also use the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password=
<em class="replaceable">
<code>
password
</code>
</em>
</code>
</a>
syntax to specify the password. If you use the
<code class="option">
-p
</code>
or
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
option with no
password value, MySQL prompts you for the password.)
</p>
</li>
<li class="listitem">
<p>
For testing purposes, start the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server with the
<a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
<code class="option">
--skip-grant-tables
</code>
</a>
option.
Then you can change the MySQL grant tables and use the
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
statement to check
whether your modifications have the desired effect. When you
are satisfied with your changes, execute
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
flush-privileges
</strong>
</span>
</a>
to tell the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server to reload the privileges.
This enables you to begin using the new grant table contents
without stopping and restarting the server.
</p>
</li>
<li class="listitem">
<p>
If everything else fails, start the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server with a debugging option (for example,
<a class="link" href="server-options.html#option_mysqld_debug">
<code class="option">
--debug=d,general,query
</code>
</a>
). This
prints host and user information about attempted connections,
as well as information about each command issued. See
<a class="xref" href="dbug-package.html" title="7.9.4 The DBUG Package">
Section 7.9.4, “The DBUG Package”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you have any other problems with the MySQL grant tables and
ask on the
<a class="ulink" href="https://mysqlcommunity.slack.com/" target="_blank">
MySQL Community
Slack
</a>
, always provide a dump of the MySQL grant
tables. You can dump the tables with the
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
mysql
</strong>
</span>
</a>
command. To file a bug report, see 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>
. In some cases,
you may need to restart
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with
<a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
<code class="option">
--skip-grant-tables
</code>
</a>
to run
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-processlist-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-processlist-table">
</a>
28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045079168848">
</a>
<a class="indexterm" name="idm46045079167392">
</a>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
INFORMATION_SCHEMA.PROCESSLIST
</code>
</a>
is
deprecated and subject to removal in a future MySQL release. As
such, the implementation of
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
which uses this table is also deprecated.
It is recommended to use the Performance Schema implementation
of
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
PROCESSLIST
</code>
</a>
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="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table is one source of
process information. For a comparison of this table with other
sources, see
<a class="xref" href="processlist-access.html#processlist-sources" title="Sources of Process Information">
Sources of Process Information
</a>
.
</p>
<p>
The
<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 has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<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
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement,
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>
<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 or SQL 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>
<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>
<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>
<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>
<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>
<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>
<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>
<h4>
<a name="idm46045079111888">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
is a nonstandard
<code class="literal">
INFORMATION_SCHEMA
</code>
table.
</p>
</li>
<li class="listitem">
<p>
Like the output from the
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
statement, the
<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 provides
information about all threads, even those belonging to other
users, if you have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege. 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>
</li>
<li class="listitem">
<p>
If an SQL statement refers to the
<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, MySQL
populates the entire table once, when statement execution
begins, so there is read consistency during the statement.
There is no read consistency for a multi-statement
transaction.
</p>
</li>
</ul>
</div>
<p>
The following statements are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55808365"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PROCESSLIST</span>
<span class="token keyword">SHOW</span> <span class="token keyword">FULL</span> <span class="token keyword">PROCESSLIST</span></code></pre>
</div>
<p>
You can obtain information about use of this table by checking the
values of the server status variables
<a class="link" href="server-status-variables.html#statvar_Deprecated_use_i_s_processlist_count">
<code class="literal">
Deprecated_use_i_s_processlist_count
</code>
</a>
and
<a class="link" href="server-status-variables.html#statvar_Deprecated_use_i_s_processlist_last_timestamp">
<code class="literal">
Deprecated_use_i_s_processlist_last_timestamp
</code>
</a>
.
<code class="literal">
Deprecated_use_i_s_processlist_count
</code>
shows the
number of times the
<code class="literal">
PROCESSLIST
</code>
table has been
accessed since the last server restart;
<code class="literal">
Deprecated_use_i_s_processlist_last_timestamp
</code>
provides the last time the table was accessed, as a Unix
timestamp.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/load-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="load-data">
</a>
15.2.9 LOAD DATA Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045181997584">
</a>
<a class="indexterm" name="idm46045181996512">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65730226"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span>
<span class="token punctuation">[</span><span class="token keyword">LOW_PRIORITY</span> <span class="token operator">|</span> <span class="token keyword">CONCURRENT</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token keyword">LOCAL</span><span class="token punctuation">]</span>
<span class="token keyword">INFILE</span> <span class="token string">'<em class="replaceable">file_name</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token operator">|</span> <span class="token keyword">IGNORE</span><span class="token punctuation">]</span>
<span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em>
<span class="token punctuation">[</span><span class="token keyword">PARTITION</span> <span class="token punctuation">(</span><em class="replaceable">partition_name</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">partition_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 punctuation">[</span><span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <em class="replaceable">charset_name</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span>{<span class="token keyword">FIELDS</span> <span class="token operator">|</span> <span class="token keyword">COLUMNS</span>}
<span class="token punctuation">[</span><span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">OPTIONALLY</span><span class="token punctuation">]</span> <span class="token keyword">ENCLOSED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">char</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">ESCAPED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">char</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">LINES</span>
<span class="token punctuation">[</span><span class="token keyword">STARTING</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">IGNORE</span> <span class="token keyword"><em class="replaceable">number</em></span> {<span class="token keyword">LINES</span> <span class="token operator">|</span> <span class="token keyword">ROWS</span>}<span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">col_name_or_user_var</em>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">col_name_or_user_var</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 punctuation">[</span><span class="token keyword">SET</span> <em class="replaceable">col_name</em><span class="token operator">=</span>{<em class="replaceable">expr</em> <span class="token operator">|</span> <span class="token keyword">DEFAULT</span>}
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">col_name</em><span class="token operator">=</span>{<em class="replaceable">expr</em> <span class="token operator">|</span> <span class="token keyword">DEFAULT</span>}<span class="token punctuation">]</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>
The
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement reads rows
from a text file into a table at a very high speed. The file can
be read from the server host or the client host, depending on
whether the
<code class="literal">
LOCAL
</code>
modifier is given.
<code class="literal">
LOCAL
</code>
also affects data interpretation and
error handling.
</p>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
is the complement of
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
. (See
<a class="xref" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
Section 15.2.13.1, “SELECT ... INTO Statement”
</a>
.) To write
data from a table to a file, use
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
. To read the file back into a table, use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
. The syntax of the
<code class="literal">
FIELDS
</code>
and
<code class="literal">
LINES
</code>
clauses is
the same for both statements.
</p>
<a class="indexterm" name="idm46045181972656">
</a>
<p>
The
<a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
<span class="command">
<strong>
mysqlimport
</strong>
</span>
</a>
utility provides another way to
load data files; it operates by sending a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement to the server.
See
<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>
.
</p>
<p>
For information about the efficiency of
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
versus
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
and speeding up
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
, see
<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>
<a class="xref" href="load-data.html#load-data-local" title="Non-LOCAL Versus LOCAL Operation">
Non-LOCAL Versus LOCAL Operation
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-character-set" title="Input File Character Set">
Input File Character Set
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-file-location" title="Input File Location">
Input File Location
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-security-requirements" title="Security Requirements">
Security Requirements
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-error-handling" title="Duplicate-Key and Error Handling">
Duplicate-Key and Error Handling
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-index-handling" title="Index Handling">
Index Handling
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-field-line-handling" title="Field and Line Handling">
Field and Line Handling
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-column-list" title="Column List Specification">
Column List Specification
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-input-preprocessing" title="Input Preprocessing">
Input Preprocessing
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-column-assignments" title="Column Value Assignment">
Column Value Assignment
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-partitioning-support" title="Partitioned Table Support">
Partitioned Table Support
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-concurrency" title="Concurrency Considerations">
Concurrency Considerations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-statement-result-information" title="Statement Result Information">
Statement Result Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-replication" title="Replication Considerations">
Replication Considerations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data.html#load-data-miscellaneous" title="Miscellaneous Topics">
Miscellaneous Topics
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-local">
</a>
Non-LOCAL Versus LOCAL Operation
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
LOCAL
</code>
modifier affects these aspects of
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
, compared to
non-
<code class="literal">
LOCAL
</code>
operation:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It changes the expected location of the input file; see
<a class="xref" href="load-data.html#load-data-file-location" title="Input File Location">
Input File Location
</a>
.
</p>
</li>
<li class="listitem">
<p>
It changes the statement security requirements; see
<a class="xref" href="load-data.html#load-data-security-requirements" title="Security Requirements">
Security Requirements
</a>
.
</p>
</li>
<li class="listitem">
<p>
Unless
<code class="literal">
REPLACE
</code>
is also specified,
<code class="literal">
LOCAL
</code>
has the same effect as the
<code class="literal">
IGNORE
</code>
modifier on the interpretation of
input file contents and error handling; see
<a class="xref" href="load-data.html#load-data-error-handling" title="Duplicate-Key and Error Handling">
Duplicate-Key and Error Handling
</a>
, and
<a class="xref" href="load-data.html#load-data-column-assignments" title="Column Value Assignment">
Column Value Assignment
</a>
.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
LOCAL
</code>
works only if the server and your
client both have been configured to permit it. For example, if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
was started with the
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
system variable
disabled,
<code class="literal">
LOCAL
</code>
produces an error. See
<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>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-character-set">
</a>
Input File Character Set
</h4>
</div>
</div>
</div>
<p>
The file name must be given as a literal string. On Windows,
specify backslashes in path names as forward slashes or doubled
backslashes. The server interprets the file name using the
character set indicated by the
<a class="link" href="server-system-variables.html#sysvar_character_set_filesystem">
<code class="literal">
character_set_filesystem
</code>
</a>
system
variable.
</p>
<p>
By default, the server interprets the file contents using the
character set indicated by the
<a class="link" href="server-system-variables.html#sysvar_character_set_database">
<code class="literal">
character_set_database
</code>
</a>
system
variable. If the file contents use a character set different
from this default, it is a good idea to specify that character
set by using the
<code class="literal">
CHARACTER SET
</code>
clause. A
character set of
<code class="literal">
binary
</code>
specifies
<span class="quote">
“
<span class="quote">
no
conversion.
</span>
”
</span>
</p>
<p>
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET NAMES
</code>
</a>
and the setting of
<a class="link" href="server-system-variables.html#sysvar_character_set_client">
<code class="literal">
character_set_client
</code>
</a>
do not
affect interpretation of file contents.
</p>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
interprets all fields
in the file as having the same character set, regardless of the
data types of the columns into which field values are loaded.
For proper interpretation of the file, you must ensure that it
was written with the correct character set. For example, if you
write a data file with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump -T
</strong>
</span>
</a>
or by
issuing a
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT
... INTO OUTFILE
</code>
</a>
statement in
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, be sure to use a
<a class="link" href="mysql-command-options.html#option_mysql_default-character-set">
<code class="option">
--default-character-set
</code>
</a>
option to
write output in the character set to be used when the file is
loaded with
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is not possible to load data files that use the
<code class="literal">
ucs2
</code>
,
<code class="literal">
utf16
</code>
,
<code class="literal">
utf16le
</code>
, or
<code class="literal">
utf32
</code>
character set.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-file-location">
</a>
Input File Location
</h4>
</div>
</div>
</div>
<p>
These rules determine the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
input file location:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
is not specified, the file must
be located on the server host. The server reads the file
directly, locating it as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the file name is an absolute path name, the server
uses it as given.
</p>
</li>
<li class="listitem">
<p>
If the file name is a relative path name with leading
components, the server looks for the file relative to
its data directory.
</p>
</li>
<li class="listitem">
<p>
If the file name has no leading components, the server
looks for the file in the database directory of the
default database.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
is specified, the file must be
located on the client host. The client program reads the
file, locating it as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the file name is an absolute path name, the client
program uses it as given.
</p>
</li>
<li class="listitem">
<p>
If the file name is a relative path name, the client
program looks for the file relative to its invocation
directory.
</p>
</li>
</ul>
</div>
<p>
When
<code class="literal">
LOCAL
</code>
is used, the client program
reads the file and sends its contents to the server. The
server creates a copy of the file in the directory where it
stores temporary files. See
<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>
. Lack of sufficient space
for the copy in this directory can cause the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statement to fail.
</p>
</li>
</ul>
</div>
<p>
The non-
<code class="literal">
LOCAL
</code>
rules mean that the server
reads a file named as
<code class="filename">
./myfile.txt
</code>
relative
to its data directory, whereas it reads a file named as
<code class="filename">
myfile.txt
</code>
from the database directory of
the default database. For example, if the following
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement is executed
while
<code class="literal">
db1
</code>
is the default database, the server
reads the file
<code class="filename">
data.txt
</code>
from the database
directory for
<code class="literal">
db1
</code>
, even though the statement
explicitly loads the file into a table in the
<code class="literal">
db2
</code>
database:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa92035246"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'data.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> db2<span class="token punctuation">.</span>my_table<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>
The server also uses the non-
<code class="literal">
LOCAL
</code>
rules to
locate
<code class="filename">
.sdi
</code>
files for the
<a class="link" href="import-table.html" title="15.2.6 IMPORT TABLE Statement">
<code class="literal">
IMPORT TABLE
</code>
</a>
statement.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-security-requirements">
</a>
Security Requirements
</h4>
</div>
</div>
</div>
<p>
For a non-
<code class="literal">
LOCAL
</code>
load operation, the server
reads a text file located on the server host, so these security
requirements must be satisfied:
</p>
<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_file">
<code class="literal">
FILE
</code>
</a>
privilege. See
<a class="xref" href="privileges-provided.html" title="8.2.2 Privileges Provided by MySQL">
Section 8.2.2, “Privileges Provided by MySQL”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The operation is subject to the
<a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
<code class="literal">
secure_file_priv
</code>
</a>
system
variable setting:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the variable value is a nonempty directory name, the
file must be located in that directory.
</p>
</li>
<li class="listitem">
<p>
If the variable value is empty (which is insecure), the
file need only be readable by the server.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For a
<code class="literal">
LOCAL
</code>
load operation, the client
program reads a text file located on the client host. Because
the file contents are sent over the connection by the client to
the server, using
<code class="literal">
LOCAL
</code>
is a bit slower than
when the server accesses the file directly. On the other hand,
you do not need the
<a class="link" href="privileges-provided.html#priv_file">
<code class="literal">
FILE
</code>
</a>
privilege, and the file can be located in any directory the
client program can access.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-error-handling">
</a>
Duplicate-Key and Error Handling
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
REPLACE
</code>
and
<code class="literal">
IGNORE
</code>
modifiers control handling of new (input) rows that duplicate
existing table rows on unique key values (
<code class="literal">
PRIMARY
KEY
</code>
or
<code class="literal">
UNIQUE
</code>
index values):
</p>
<a class="indexterm" name="idm46045181862192">
</a>
<a class="indexterm" name="idm46045181860704">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With
<code class="literal">
REPLACE
</code>
, new rows that have the same
value as a unique key value in an existing row replace the
existing row. See
<a class="xref" href="replace.html" title="15.2.12 REPLACE Statement">
Section 15.2.12, “REPLACE Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
With
<code class="literal">
IGNORE
</code>
, new rows that duplicate an
existing row on a unique key value are discarded. For more
information, see
<a class="xref" href="sql-mode.html#ignore-effect-on-execution" title="The Effect of IGNORE on Statement Execution">
The Effect of IGNORE on Statement Execution
</a>
.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
LOCAL
</code>
modifier has the same effect as
<code class="literal">
IGNORE
</code>
. This occurs because the server has no
way to stop transmission of the file in the middle of the
operation.
</p>
<p>
If none of
<code class="literal">
REPLACE
</code>
,
<code class="literal">
IGNORE
</code>
, or
<code class="literal">
LOCAL
</code>
is
specified, an error occurs when a duplicate key value is found,
and the rest of the text file is ignored.
</p>
<p>
In addition to affecting duplicate-key handling as just
described,
<code class="literal">
IGNORE
</code>
and
<code class="literal">
LOCAL
</code>
also affect error handling:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When neither
<code class="literal">
IGNORE
</code>
nor
<code class="literal">
LOCAL
</code>
is specified, data-interpretation
errors terminate the operation.
</p>
</li>
<li class="listitem">
<p>
When
<code class="literal">
IGNORE
</code>
—or
<code class="literal">
LOCAL
</code>
without
<code class="literal">
REPLACE
</code>
—is specified, data
interpretation errors become warnings and the load operation
continues, even if the SQL mode is restrictive. For
examples, see
<a class="xref" href="load-data.html#load-data-column-assignments" title="Column Value Assignment">
Column Value Assignment
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-index-handling">
</a>
Index Handling
</h4>
</div>
</div>
</div>
<p>
To ignore foreign key constraints during the load operation,
execute a
<code class="literal">
SET foreign_key_checks = 0
</code>
statement before executing
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
.
</p>
<p>
If you use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
on an empty
<code class="literal">
MyISAM
</code>
table, all nonunique indexes are
created in a separate batch (as for
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR
TABLE
</code>
</a>
). Normally, this makes
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
much faster when you have many indexes. In some
extreme cases, you can create the indexes even faster by turning
them off with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE ... DISABLE KEYS
</code>
</a>
before loading the file into
the table and re-creating the indexes with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ENABLE KEYS
</code>
</a>
after loading the file. See
<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>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-field-line-handling">
</a>
Field and Line Handling
</h4>
</div>
</div>
</div>
<p>
For both the
<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="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
statements, the syntax of the
<code class="literal">
FIELDS
</code>
and
<code class="literal">
LINES
</code>
clauses
is the same. Both clauses are optional, but
<code class="literal">
FIELDS
</code>
must precede
<code class="literal">
LINES
</code>
if both are specified.
</p>
<p>
If you specify a
<code class="literal">
FIELDS
</code>
clause, each of its
subclauses (
<code class="literal">
TERMINATED BY
</code>
,
<code class="literal">
[OPTIONALLY] ENCLOSED BY
</code>
, and
<code class="literal">
ESCAPED BY
</code>
) is also optional, except that you
must specify at least one of them. Arguments to these clauses
are permitted to contain only ASCII characters.
</p>
<p>
If you specify no
<code class="literal">
FIELDS
</code>
or
<code class="literal">
LINES
</code>
clause, the defaults are the same as if
you had written this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28885795"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'\t'</span> <span class="token keyword">ENCLOSED</span> <span class="token keyword">BY</span> <span class="token string">''</span> <span class="token keyword">ESCAPED</span> <span class="token keyword">BY</span> <span class="token string">'\\'</span>
<span class="token keyword">LINES</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'\n'</span> <span class="token keyword">STARTING</span> <span class="token keyword">BY</span> <span class="token string">''</span></code></pre>
</div>
<p>
Backslash is the MySQL escape character within strings in SQL
statements. Thus, to specify a literal backslash, you must
specify two backslashes for the value to be interpreted as a
single backslash. The escape sequences
<code class="literal">
'\t'
</code>
and
<code class="literal">
'\n'
</code>
specify tab and newline characters,
respectively.
</p>
<p>
In other words, the defaults cause
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
to act as follows when reading input:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Look for line boundaries at newlines.
</p>
</li>
<li class="listitem">
<p>
Do not skip any line prefix.
</p>
</li>
<li class="listitem">
<p>
Break lines into fields at tabs.
</p>
</li>
<li class="listitem">
<p>
Do not expect fields to be enclosed within any quoting
characters.
</p>
</li>
<li class="listitem">
<p>
Interpret characters preceded by the escape character
<code class="literal">
\
</code>
as escape sequences. For example,
<code class="literal">
\t
</code>
,
<code class="literal">
\n
</code>
, and
<code class="literal">
\\
</code>
signify tab, newline, and backslash,
respectively. See the discussion of
<code class="literal">
FIELDS ESCAPED
BY
</code>
later for the full list of escape sequences.
</p>
</li>
</ul>
</div>
<p>
Conversely, the defaults cause
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
to act as follows when writing output:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Write tabs between fields.
</p>
</li>
<li class="listitem">
<p>
Do not enclose fields within any quoting characters.
</p>
</li>
<li class="listitem">
<p>
Use
<code class="literal">
\
</code>
to escape instances of tab,
newline, or
<code class="literal">
\
</code>
that occur within field
values.
</p>
</li>
<li class="listitem">
<p>
Write newlines at the ends of lines.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For a text file generated on a Windows system, proper file
reading might require
<code class="literal">
LINES TERMINATED BY
'\r\n'
</code>
because Windows programs typically use two
characters as a line terminator. Some programs, such as
<span class="command">
<strong>
WordPad
</strong>
</span>
, might use
<code class="literal">
\r
</code>
as
a line terminator when writing files. To read such files, use
<code class="literal">
LINES TERMINATED BY '\r'
</code>
.
</p>
</div>
<p>
If all the input lines have a common prefix that you want to
ignore, you can use
<code class="literal">
LINES STARTING BY
'
<em class="replaceable">
<code>
prefix_string
</code>
</em>
'
</code>
to skip the
prefix
<span class="emphasis">
<em>
and anything before it
</em>
</span>
. If a line
does not include the prefix, the entire line is skipped. Suppose
that you issue the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41173242"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'/tmp/test.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> test
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">','</span> <span class="token keyword">LINES</span> <span class="token keyword">STARTING</span> <span class="token keyword">BY</span> <span class="token string">'xxx'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the data file looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa43540291"><div class="copy-help left">Press ⌘+C to 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">xxx"abc",1
something xxx"def",2
"ghi",3</code></pre>
</div>
<p>
The resulting rows are
<code class="literal">
("abc",1)
</code>
and
<code class="literal">
("def",2)
</code>
. The third row in the file is
skipped because it does not contain the prefix.
</p>
<p>
The
<code class="literal">
IGNORE
<em class="replaceable">
<code>
number
</code>
</em>
LINES
</code>
clause can be used to ignore lines at the start
of the file. For example, you can use
<code class="literal">
IGNORE 1
LINES
</code>
to skip an initial header line containing column
names:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37171047"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'/tmp/test.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> test <span class="token keyword">IGNORE</span> <span class="token number">1</span> <span class="token keyword">LINES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When you use
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT
... INTO OUTFILE
</code>
</a>
in tandem with
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
to write data from a
database into a file and then read the file back into the
database later, the field- and line-handling options for both
statements must match. Otherwise,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
does not interpret the contents of the file
properly. Suppose that you use
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
to write a file with fields delimited by
commas:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76153254"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INTO</span> <span class="token keyword">OUTFILE</span> <span class="token string">'data.txt'</span>
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">','</span>
<span class="token keyword">FROM</span> table2<span class="token punctuation">;</span></code></pre>
</div>
<p>
To read the comma-delimited file, the correct statement is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2585884"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'data.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> table2
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">','</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If instead you tried to read the file with the statement shown
following, it would not work because it instructs
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
to look for tabs
between fields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49073431"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'data.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> table2
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'\t'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The likely result is that each input line would be interpreted
as a single field.
</p>
<a class="indexterm" name="idm46045181770880">
</a>
<a class="indexterm" name="idm46045181769808">
</a>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
can be used to read
files obtained from external sources. For example, many programs
can export data in comma-separated values (CSV) format, such
that lines have fields separated by commas and enclosed within
double quotation marks, with an initial line of column names. If
the lines in such a file are terminated by carriage
return/newline pairs, the statement shown here illustrates the
field- and line-handling options you would use to load the file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56774508"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'data.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">','</span> <span class="token keyword">ENCLOSED</span> <span class="token keyword">BY</span> <span class="token string">'"'</span>
<span class="token keyword">LINES</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'\r\n'</span>
<span class="token keyword">IGNORE</span> <span class="token number">1</span> <span class="token keyword">LINES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the input values are not necessarily enclosed within
quotation marks, use
<code class="literal">
OPTIONALLY
</code>
before the
<code class="literal">
ENCLOSED BY
</code>
option.
</p>
<p>
Any of the field- or line-handling options can specify an empty
string (
<code class="literal">
''
</code>
). If not empty, the
<code class="literal">
FIELDS [OPTIONALLY] ENCLOSED BY
</code>
and
<code class="literal">
FIELDS ESCAPED BY
</code>
values must be a single
character. The
<code class="literal">
FIELDS TERMINATED BY
</code>
,
<code class="literal">
LINES STARTING BY
</code>
, and
<code class="literal">
LINES
TERMINATED BY
</code>
values can be more than one character.
For example, to write lines that are terminated by carriage
return/linefeed pairs, or to read a file containing such lines,
specify a
<code class="literal">
LINES TERMINATED BY '\r\n'
</code>
clause.
</p>
<p>
To read a file containing jokes that are separated by lines
consisting of
<code class="literal">
%%
</code>
, you can do this
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61609131"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> jokes
<span class="token punctuation">(</span>a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</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>
joke <span class="token datatype">TEXT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'/tmp/jokes.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> jokes
<span class="token keyword">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">''</span>
<span class="token keyword">LINES</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'\n%%\n'</span> <span class="token punctuation">(</span>joke<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
FIELDS [OPTIONALLY] ENCLOSED BY
</code>
controls
quoting of fields. For output
(
<a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
), if you omit the word
<code class="literal">
OPTIONALLY
</code>
, all fields are enclosed by the
<code class="literal">
ENCLOSED BY
</code>
character. An example of such
output (using a comma as the field delimiter) is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa91097283"><div class="copy-help left">Press ⌘+C to 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">"1","a string","100.20"
"2","a string containing a , comma","102.20"
"3","a string containing a \" quote","102.20"
"4","a string containing a \", quote and comma","102.20"</code></pre>
</div>
<p>
If you specify
<code class="literal">
OPTIONALLY
</code>
, the
<code class="literal">
ENCLOSED BY
</code>
character is used only to enclose
values from columns that have a string data type (such as
<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="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<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="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa4969055"><div class="copy-help left">Press ⌘+C to 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">1,"a string",100.20
2,"a string containing a , comma",102.20
3,"a string containing a \" quote",102.20
4,"a string containing a \", quote and comma",102.20</code></pre>
</div>
<p>
Occurrences of the
<code class="literal">
ENCLOSED BY
</code>
character
within a field value are escaped by prefixing them with the
<code class="literal">
ESCAPED BY
</code>
character. Also, if you specify an
empty
<code class="literal">
ESCAPED BY
</code>
value, it is possible to
inadvertently generate output that cannot be read properly by
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
. For example, the
preceding output just shown would appear as follows if the
escape character is empty. Observe that the second field in the
fourth line contains a comma following the quote, which
(erroneously) appears to terminate the field:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa9658623"><div class="copy-help left">Press ⌘+C to 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">1,"a string",100.20
2,"a string containing a , comma",102.20
3,"a string containing a " quote",102.20
4,"a string containing a ", quote and comma",102.20</code></pre>
</div>
<p>
For input, the
<code class="literal">
ENCLOSED BY
</code>
character, if
present, is stripped from the ends of field values. (This is
true regardless of whether
<code class="literal">
OPTIONALLY
</code>
is
specified;
<code class="literal">
OPTIONALLY
</code>
has no effect on input
interpretation.) Occurrences of the
<code class="literal">
ENCLOSED
BY
</code>
character preceded by the
<code class="literal">
ESCAPED
BY
</code>
character are interpreted as part of the current
field value.
</p>
<p>
If the field begins with the
<code class="literal">
ENCLOSED BY
</code>
character, instances of that character are recognized as
terminating a field value only if followed by the field or line
<code class="literal">
TERMINATED BY
</code>
sequence. To avoid ambiguity,
occurrences of the
<code class="literal">
ENCLOSED BY
</code>
character
within a field value can be doubled and are interpreted as a
single instance of the character. For example, if
<code class="literal">
ENCLOSED BY '"'
</code>
is specified, quotation marks
are handled as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa17834226"><div class="copy-help left">Press ⌘+C to 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">"The ""BIG"" boss" -> The "BIG" boss
The "BIG" boss -> The "BIG" boss
The ""BIG"" boss -> The ""BIG"" boss</code></pre>
</div>
<p>
<code class="literal">
FIELDS ESCAPED BY
</code>
controls how to read or
write special characters:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For input, if the
<code class="literal">
FIELDS ESCAPED BY
</code>
character is not empty, occurrences of that character are
stripped and the following character is taken literally as
part of a field value. Some two-character sequences that are
exceptions, where the first character is the escape
character. These sequences are shown in the following table
(using
<code class="literal">
\
</code>
for the escape character). The
rules for
<code class="literal">
NULL
</code>
handling are described
later in this section.
</p>
<div class="informaltable">
<table summary="Two-character sequences for which the first character (a \) is the escape character.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 85%"/>
</colgroup>
<thead>
<tr>
<th>
Character
</th>
<th>
Escape Sequence
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
\0
</code>
<a class="indexterm" name="idm46045181716560">
</a>
<a class="indexterm" name="idm46045181715616">
</a>
</td>
<td>
An ASCII NUL (
<code class="literal">
X'00'
</code>
) character
</td>
</tr>
<tr>
<td>
<code class="literal">
\b
</code>
<a class="indexterm" name="idm46045181711440">
</a>
<a class="indexterm" name="idm46045181710496">
</a>
</td>
<td>
A backspace character
</td>
</tr>
<tr>
<td>
<code class="literal">
\n
</code>
<a class="indexterm" name="idm46045181707008">
</a>
<a class="indexterm" name="idm46045181706064">
</a>
<a class="indexterm" name="idm46045181705120">
</a>
<a class="indexterm" name="idm46045181704176">
</a>
</td>
<td>
A newline (linefeed) character
</td>
</tr>
<tr>
<td>
<code class="literal">
\r
</code>
<a class="indexterm" name="idm46045181700672">
</a>
<a class="indexterm" name="idm46045181699728">
</a>
<a class="indexterm" name="idm46045181698784">
</a>
</td>
<td>
A carriage return character
</td>
</tr>
<tr>
<td>
<code class="literal">
\t
</code>
<a class="indexterm" name="idm46045181695280">
</a>
<a class="indexterm" name="idm46045181694336">
</a>
</td>
<td>
A tab character.
</td>
</tr>
<tr>
<td>
<code class="literal">
\Z
</code>
<a class="indexterm" name="idm46045181690848">
</a>
<a class="indexterm" name="idm46045181689904">
</a>
</td>
<td>
ASCII 26 (Control+Z)
</td>
</tr>
<tr>
<td>
<code class="literal">
\N
</code>
<a class="indexterm" name="idm46045181686416">
</a>
</td>
<td>
NULL
</td>
</tr>
</tbody>
</table>
</div>
<p>
For more information about
<code class="literal">
\
</code>
-escape
syntax, see
<a class="xref" href="string-literals.html" title="11.1.1 String Literals">
Section 11.1.1, “String Literals”
</a>
.
</p>
<p>
If the
<code class="literal">
FIELDS ESCAPED BY
</code>
character is
empty, escape-sequence interpretation does not occur.
</p>
</li>
<li class="listitem">
<p>
For output, if the
<code class="literal">
FIELDS ESCAPED BY
</code>
character is not empty, it is used to prefix the following
characters on output:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<code class="literal">
FIELDS ESCAPED BY
</code>
character.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
FIELDS [OPTIONALLY] ENCLOSED BY
</code>
character.
</p>
</li>
<li class="listitem">
<p>
The first character of the
<code class="literal">
FIELDS TERMINATED
BY
</code>
and
<code class="literal">
LINES TERMINATED BY
</code>
values, if the
<code class="literal">
ENCLOSED BY
</code>
character
is empty or unspecified.
</p>
</li>
<li class="listitem">
<p>
ASCII
<code class="literal">
0
</code>
(what is actually written
following the escape character is ASCII
<code class="literal">
0
</code>
, not a zero-valued byte).
</p>
</li>
</ul>
</div>
<p>
If the
<code class="literal">
FIELDS ESCAPED BY
</code>
character is
empty, no characters are escaped and
<code class="literal">
NULL
</code>
is output as
<code class="literal">
NULL
</code>
, not
<code class="literal">
\N
</code>
. It is probably not a good idea to
specify an empty escape character, particularly if field
values in your data contain any of the characters in the
list just given.
</p>
</li>
</ul>
</div>
<p>
In certain cases, field- and line-handling options interact:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<code class="literal">
LINES TERMINATED BY
</code>
is an empty string
and
<code class="literal">
FIELDS TERMINATED BY
</code>
is nonempty,
lines are also terminated with
<code class="literal">
FIELDS TERMINATED
BY
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
FIELDS TERMINATED BY
</code>
and
<code class="literal">
FIELDS ENCLOSED BY
</code>
values are both empty
(
<code class="literal">
''
</code>
), a fixed-row (nondelimited) format
is used. With fixed-row format, no delimiters are used
between fields (but you can still have a line terminator).
Instead, column values are read and written using a field
width wide enough to hold all values in the field. For
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
TINYINT
</code>
</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">
SMALLINT
</code>
</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">
MEDIUMINT
</code>
</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">
INT
</code>
</a>
, and
<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>
, the field widths are
4, 6, 8, 11, and 20, respectively, no matter what the
declared display width is.
</p>
<p>
<code class="literal">
LINES TERMINATED BY
</code>
is still used to
separate lines. If a line does not contain all fields, the
rest of the columns are set to their default values. If you
do not have a line terminator, you should set this to
<code class="literal">
''
</code>
. In this case, the text file must
contain all fields for each row.
</p>
<p>
Fixed-row format also affects handling of
<code class="literal">
NULL
</code>
values, as described later.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Fixed-size format does not work if you are using a
multibyte character set.
</p>
</div>
</li>
</ul>
</div>
<p>
Handling of
<code class="literal">
NULL
</code>
values varies according to
the
<code class="literal">
FIELDS
</code>
and
<code class="literal">
LINES
</code>
options in use:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For the default
<code class="literal">
FIELDS
</code>
and
<code class="literal">
LINES
</code>
values,
<code class="literal">
NULL
</code>
is
written as a field value of
<code class="literal">
\N
</code>
for
output, and a field value of
<code class="literal">
\N
</code>
is read
as
<code class="literal">
NULL
</code>
for input (assuming that the
<code class="literal">
ESCAPED BY
</code>
character is
<code class="literal">
\
</code>
).
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
FIELDS ENCLOSED BY
</code>
is not empty, a
field containing the literal word
<code class="literal">
NULL
</code>
as
its value is read as a
<code class="literal">
NULL
</code>
value. This
differs from the word
<code class="literal">
NULL
</code>
enclosed
within
<code class="literal">
FIELDS ENCLOSED BY
</code>
characters,
which is read as the string
<code class="literal">
'NULL'
</code>
.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
FIELDS ESCAPED BY
</code>
is empty,
<code class="literal">
NULL
</code>
is written as the word
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
With fixed-row format (which is used when
<code class="literal">
FIELDS
TERMINATED BY
</code>
and
<code class="literal">
FIELDS ENCLOSED
BY
</code>
are both empty),
<code class="literal">
NULL
</code>
is
written as an empty string. This causes both
<code class="literal">
NULL
</code>
values and empty strings in the
table to be indistinguishable when written to the file
because both are written as empty strings. If you need to be
able to tell the two apart when reading the file back in,
you should not use fixed-row format.
</p>
</li>
</ul>
</div>
<p>
An attempt to load
<code class="literal">
NULL
</code>
into a
<code class="literal">
NOT
NULL
</code>
column produces either a warning or an error
according to the rules described in
<a class="xref" href="load-data.html#load-data-column-assignments" title="Column Value Assignment">
Column Value Assignment
</a>
.
</p>
<p>
Some cases are not supported by
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Fixed-size rows (
<code class="literal">
FIELDS TERMINATED BY
</code>
and
<code class="literal">
FIELDS ENCLOSED BY
</code>
both empty) and
<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>
columns.
</p>
</li>
<li class="listitem">
<p>
If you specify one separator that is the same as or a prefix
of another,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
cannot
interpret the input properly. For example, the following
<code class="literal">
FIELDS
</code>
clause would cause problems:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa75769472"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FIELDS</span> <span class="token keyword">TERMINATED</span> <span class="token keyword">BY</span> <span class="token string">'"'</span> <span class="token keyword">ENCLOSED</span> <span class="token keyword">BY</span> <span class="token string">'"'</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If
<code class="literal">
FIELDS ESCAPED BY
</code>
is empty, a field
value that contains an occurrence of
<code class="literal">
FIELDS
ENCLOSED BY
</code>
or
<code class="literal">
LINES TERMINATED
BY
</code>
followed by the
<code class="literal">
FIELDS TERMINATED
BY
</code>
value causes
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
to stop reading a field or line too early.
This happens because
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
cannot properly determine where the field or
line value ends.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-column-list">
</a>
Column List Specification
</h4>
</div>
</div>
</div>
<p>
The following example loads all columns of the
<code class="literal">
persondata
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23601709"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'persondata.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> persondata<span class="token punctuation">;</span></code></pre>
</div>
<p>
By default, when no column list is provided at the end of the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement, input lines
are expected to contain a field for each table column. If you
want to load only some of a table's columns, specify a column
list:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92692341"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'persondata.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> persondata
<span class="token punctuation">(</span><em class="replaceable">col_name_or_user_var</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">col_name_or_user_var</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></code></pre>
</div>
<p>
You must also specify a column list if the order of the fields
in the input file differs from the order of the columns in the
table. Otherwise, MySQL cannot tell how to match input fields
with table columns.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-input-preprocessing">
</a>
Input Preprocessing
</h4>
</div>
</div>
</div>
<p>
Each instance of
<em class="replaceable">
<code>
col_name_or_user_var
</code>
</em>
in
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
syntax is either a
column name or a user variable. With user variables, the
<code class="literal">
SET
</code>
clause enables you to perform
preprocessing transformations on their values before assigning
the result to columns.
</p>
<p>
User variables in the
<code class="literal">
SET
</code>
clause can be used
in several ways. The following example uses the first input
column directly for the value of
<code class="literal">
t1.column1
</code>
,
and assigns the second input column to a user variable that is
subjected to a division operation before being used for the
value of
<code class="literal">
t1.column2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87520948"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'file.txt'</span>
<span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>column1<span class="token punctuation">,</span> <span class="token variable">@var1</span><span class="token punctuation">)</span>
<span class="token keyword">SET</span> column2 <span class="token operator">=</span> <span class="token variable">@var1</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
SET
</code>
clause can be used to supply values
not derived from the input file. The following statement sets
<code class="literal">
column3
</code>
to the current date and time:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24794844"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'file.txt'</span>
<span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>column1<span class="token punctuation">,</span> column2<span class="token punctuation">)</span>
<span class="token keyword">SET</span> column3 <span class="token operator">=</span> <span class="token keyword">CURRENT_TIMESTAMP</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can also discard an input value by assigning it to a user
variable and not assigning the variable to any table column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25049182"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">INFILE</span> <span class="token string">'file.txt'</span>
<span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>column1<span class="token punctuation">,</span> <span class="token variable">@dummy</span><span class="token punctuation">,</span> column2<span class="token punctuation">,</span> <span class="token variable">@dummy</span><span class="token punctuation">,</span> column3<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Use of the column/variable list and
<code class="literal">
SET
</code>
clause is subject to the following restrictions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Assignments in the
<code class="literal">
SET
</code>
clause should have
only column names on the left hand side of assignment
operators.
</p>
</li>
<li class="listitem">
<p>
You can use subqueries in the right hand side of
<code class="literal">
SET
</code>
assignments. A subquery that returns
a value to be assigned to a column may be a scalar subquery
only. Also, you cannot use a subquery to select from the
table that is being loaded.
</p>
</li>
<li class="listitem">
<p>
Lines ignored by an
<code class="literal">
IGNORE
<em class="replaceable">
<code>
number
</code>
</em>
LINES
</code>
clause are
not processed for the column/variable list or
<code class="literal">
SET
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
User variables cannot be used when loading data with
fixed-row format because user variables do not have a
display width.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-column-assignments">
</a>
Column Value Assignment
</h4>
</div>
</div>
</div>
<p>
To process an input line,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
splits it into fields and uses the values
according to the column/variable list and the
<code class="literal">
SET
</code>
clause, if they are present. Then the
resulting row is inserted into the table. If there are
<code class="literal">
BEFORE INSERT
</code>
or
<code class="literal">
AFTER
INSERT
</code>
triggers for the table, they are activated
before or after inserting the row, respectively.
</p>
<p>
Interpretation of field values and assignment to table columns
depends on these factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The SQL mode (the value of the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system variable).
The mode can be nonrestrictive, or restrictive in various
ways. For example, strict SQL mode can be enabled, or the
mode can include values such as
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
or
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Presence or absence of the
<code class="literal">
IGNORE
</code>
and
<code class="literal">
LOCAL
</code>
modifiers.
</p>
</li>
</ul>
</div>
<p>
Those factors combine to produce restrictive or nonrestrictive
data interpretation by
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Data interpretation is restrictive if the SQL mode is
restrictive and neither the
<code class="literal">
IGNORE
</code>
nor
the
<code class="literal">
LOCAL
</code>
modifier is specified. Errors
terminate the load operation.
</p>
</li>
<li class="listitem">
<p>
Data interpretation is nonrestrictive if the SQL mode is
nonrestrictive or the
<code class="literal">
IGNORE
</code>
or
<code class="literal">
LOCAL
</code>
modifier is specified. (In
particular, either modifier if specified
<span class="emphasis">
<em>
overrides
</em>
</span>
a restrictive SQL mode when
the
<code class="literal">
REPLACE
</code>
modifier is omitted.) Errors
become warnings and the load operation continues.
</p>
</li>
</ul>
</div>
<p>
Restrictive data interpretation uses these rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Too many or too few fields results an error.
</p>
</li>
<li class="listitem">
<p>
Assigning
<code class="literal">
NULL
</code>
(that is,
<code class="literal">
\N
</code>
) to a non-
<code class="literal">
NULL
</code>
column results in an error.
</p>
</li>
<li class="listitem">
<p>
A value that is out of range for the column data type
results in an error.
</p>
</li>
<li class="listitem">
<p>
Invalid values produce errors. For example, a value such as
<code class="literal">
'x'
</code>
for a numeric column results in an
error, not conversion to 0.
</p>
</li>
</ul>
</div>
<p>
By contrast, nonrestrictive data interpretation uses these
rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If an input line has too many fields, the extra fields are
ignored and the number of warnings is incremented.
</p>
</li>
<li class="listitem">
<p>
If an input line has too few fields, the columns for which
input fields are missing are assigned their default values.
Default value assignment is described in
<a class="xref" href="data-type-defaults.html" title="13.6 Data Type Default Values">
Section 13.6, “Data Type Default Values”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Assigning
<code class="literal">
NULL
</code>
(that is,
<code class="literal">
\N
</code>
) to a non-
<code class="literal">
NULL
</code>
column results in assignment of the implicit default value
for the column data type. Implicit default values are
described in
<a class="xref" href="data-type-defaults.html" title="13.6 Data Type Default Values">
Section 13.6, “Data Type Default Values”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Invalid values produce warnings rather than errors, and are
converted to the
<span class="quote">
“
<span class="quote">
closest
</span>
”
</span>
valid value for the
column data type. Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A value such as
<code class="literal">
'x'
</code>
for a numeric
column results in conversion to 0.
</p>
</li>
<li class="listitem">
<p>
An out-of-range numeric or temporal value is clipped to
the closest endpoint of the range for the column data
type.
</p>
</li>
<li class="listitem">
<p>
An invalid value for a
<code class="literal">
DATETIME
</code>
,
<code class="literal">
DATE
</code>
, or
<code class="literal">
TIME
</code>
column is inserted as the implicit default value,
regardless of the SQL mode
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
setting.
The implicit default is the appropriate
<span class="quote">
“
<span class="quote">
zero
</span>
”
</span>
value for the type
(
<code class="literal">
'0000-00-00 00:00:00'
</code>
,
<code class="literal">
'0000-00-00'
</code>
, or
<code class="literal">
'00:00:00'
</code>
). See
<a class="xref" href="date-and-time-types.html" title="13.2 Date and Time Data Types">
Section 13.2, “Date and Time Data Types”
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
interprets an empty
field value differently from a missing field:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For string types, the column is set to the empty string.
</p>
</li>
<li class="listitem">
<p>
For numeric types, the column is set to
<code class="literal">
0
</code>
.
</p>
</li>
<li class="listitem">
<p>
For date and time types, the column is set to the
appropriate
<span class="quote">
“
<span class="quote">
zero
</span>
”
</span>
value for the type. See
<a class="xref" href="date-and-time-types.html" title="13.2 Date and Time Data Types">
Section 13.2, “Date and Time Data Types”
</a>
.
</p>
</li>
</ul>
</div>
<p>
These are the same values that result if you assign an empty
string explicitly to a string, numeric, or date or time type
explicitly in an
<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>
statement.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
columns are set to the
current date and time only if there is a
<code class="literal">
NULL
</code>
value for the column (that is,
<code class="literal">
\N
</code>
) and the
column is not declared to permit
<code class="literal">
NULL
</code>
values,
or if the
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
column
default value is the current timestamp and it is omitted from
the field list when a field list is specified.
</p>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
regards all input as
strings, so you cannot use numeric values for
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
or
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
columns the way you can with
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements. All
<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>
values must be specified as
strings.
</p>
<p>
<a class="link" href="bit-type.html" title="13.1.5 Bit-Value Type - BIT">
<code class="literal">
BIT
</code>
</a>
values cannot be loaded
directly using binary notation (for example,
<code class="literal">
b'011010'
</code>
). To work around this, use the
<code class="literal">
SET
</code>
clause to strip off the leading
<code class="literal">
b'
</code>
and trailing
<code class="literal">
'
</code>
and
perform a base-2 to base-10 conversion so that MySQL loads the
values into the
<a class="link" href="bit-type.html" title="13.1.5 Bit-Value Type - BIT">
<code class="literal">
BIT
</code>
</a>
column
properly:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76133076"><div class="copy-help left">Press ⌘+C to 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">cat</span> /tmp/bit_test<span class="token punctuation">.</span>txt
b<span class="token atrule">'10'</span>
b<span class="token atrule">'1111111'</span>
<span class="token prompt">$> </span><span class="token command">mysql</span> test
<span class="token prompt">mysql></span><span class="token command"> LOAD</span> DATA INFILE <span class="token atrule">'/tmp/bit_test.txt'</span>
INTO TABLE bit_test <span class="token punctuation">(</span>@var1<span class="token punctuation">)</span>
SET b = CAST<span class="token punctuation">(</span>CONV<span class="token punctuation">(</span>MID<span class="token punctuation">(</span>@var1<span class="token punctuation">,</span> 3<span class="token punctuation">,</span> LENGTH<span class="token punctuation">(</span>@var1<span class="token punctuation">)</span>-3<span class="token punctuation">)</span><span class="token punctuation">,</span> 2<span class="token punctuation">,</span> 10<span class="token punctuation">)</span> AS UNSIGNED<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 2 rows affected (0.00 sec)</span>
<span class="token output">Records: 2 Deleted: 0 Skipped: 0 Warnings: 0</span>
<span class="token prompt">mysql></span><span class="token command"> SELECT</span> BIN<span class="token punctuation">(</span>b+0<span class="token punctuation">)</span> FROM bit_test<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> BIN(b<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>
<span class="token output"><span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1111111 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
For
<a class="link" href="bit-type.html" title="13.1.5 Bit-Value Type - BIT">
<code class="literal">
BIT
</code>
</a>
values in
<code class="literal">
0b
</code>
binary notation (for example,
<code class="literal">
0b011010
</code>
), use this
<code class="literal">
SET
</code>
clause instead to strip off the leading
<code class="literal">
0b
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63962776"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> b <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token function">CONV</span><span class="token punctuation">(</span><span class="token function">MID</span><span class="token punctuation">(</span><span class="token variable">@var1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span><span class="token variable">@var1</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 number">2</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">UNSIGNED</span><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-partitioning-support">
</a>
Partitioned Table Support
</h4>
</div>
</div>
</div>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
supports explicit
partition selection using the
<code class="literal">
PARTITION
</code>
clause with a list of one or more comma-separated names of
partitions, subpartitions, or both. When this clause is used, if
any rows from the file cannot be inserted into any of the
partitions or subpartitions named in the list, the statement
fails with the error
<span class="errortext">
Found a row not matching the
given partition set
</span>
. For more information and
examples, see
<a class="xref" href="partitioning-selection.html" title="26.5 Partition Selection">
Section 26.5, “Partition Selection”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-concurrency">
</a>
Concurrency Considerations
</h4>
</div>
</div>
</div>
<p>
With the
<code class="literal">
LOW_PRIORITY
</code>
modifier, execution of
the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement is
delayed until no other clients are reading from the table. This
affects only storage engines that use only table-level locking
(such as
<code class="literal">
MyISAM
</code>
,
<code class="literal">
MEMORY
</code>
,
and
<code class="literal">
MERGE
</code>
).
</p>
<p>
With the
<code class="literal">
CONCURRENT
</code>
modifier and a
<code class="literal">
MyISAM
</code>
table that satisfies the condition for
concurrent inserts (that is, it contains no free blocks in the
middle), other threads can retrieve data from the table while
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
is executing. This
modifier affects the performance of
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
a bit, even if no other thread is using the table
at the same time.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-statement-result-information">
</a>
Statement Result Information
</h4>
</div>
</div>
</div>
<p>
When the
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement
finishes, it returns an information string in the following
format:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa24219697"><div class="copy-help left">Press ⌘+C to 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">Records: 1 Deleted: 0 Skipped: 0 Warnings: 0</code></pre>
</div>
<p>
Warnings occur under the same circumstances as when values are
inserted using the
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement (see
<a class="xref" href="insert.html" title="15.2.7 INSERT Statement">
Section 15.2.7, “INSERT Statement”
</a>
), except that
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
also generates warnings
when there are too few or too many fields in the input row.
</p>
<p>
You can use
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW WARNINGS
</code>
</a>
to get
a list of the first
<a class="link" href="server-system-variables.html#sysvar_max_error_count">
<code class="literal">
max_error_count
</code>
</a>
warnings as
information about what went wrong. See
<a class="xref" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
Section 15.7.7.42, “SHOW WARNINGS Statement”
</a>
.
</p>
<a class="indexterm" name="idm46045181463712">
</a>
<p>
If you are using the C API, you can get information about the
statement by calling the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-info.html" target="_top">
<code class="literal">
mysql_info()
</code>
</a>
function. See
<a class="ulink" href="/doc/c-api/8.4/en/mysql-info.html" target="_top">
mysql_info()
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-replication">
</a>
Replication Considerations
</h4>
</div>
</div>
</div>
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
is considered unsafe
for statement-based replication. If you use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
with
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=STATEMENT
</code>
</a>
, each
replica on which the changes are to be applied creates a
temporary file containing the data. This temporary file is not
encrypted, even if binary log encryption is active on the
source, If encryption is required, use row-based or mixed binary
logging format instead, for which replicas do not create the
temporary file. For more information on the interaction between
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
and replication, see
<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>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-miscellaneous">
</a>
Miscellaneous Topics
</h4>
</div>
</div>
</div>
<p>
On Unix, if you need
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
to
read from a pipe, you can use the following technique (the
example loads a listing of the
<code class="filename">
/
</code>
directory
into the table
<code class="literal">
db1.t1
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97585957"><div class="copy-help left">Press ⌘+C to 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">mkfifo /mysql/data/db1/ls<span class="token punctuation">.</span>dat
chmod 666 /mysql/data/db1/ls<span class="token punctuation">.</span>dat
find / <span class="token property">-ls</span> > /mysql/data/db1/ls<span class="token punctuation">.</span>dat &
mysql <span class="token property">-e</span> <span class="token atrule">"LOAD DATA INFILE 'ls.dat' INTO TABLE t1"</span> db1</code></pre>
</div>
<p>
Here you must run the command that generates the data to be
loaded and 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>
commands either on
separate terminals, or run the data generation process in the
background (as shown in the preceding example). If you do not do
this, the pipe blocks until data is read 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>
process.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/cannot-roll-back.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="cannot-roll-back">
</a>
15.3.2 Statements That Cannot Be Rolled Back
</h3>
</div>
</div>
</div>
<p>
Some statements cannot be rolled back. In general, these include
data definition language (DDL) statements, such as those that
create or drop databases, those that create, drop, or alter tables
or stored routines.
</p>
<p>
You should design your transactions not to include such
statements. If you issue a statement early in a transaction that
cannot be rolled back, and then another statement later fails, the
full effect of the transaction cannot be rolled back in such cases
by issuing a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
statement.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-limitations-limits.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-limitations-limits">
</a>
25.2.7.2 Limits and Differences of NDB Cluster from Standard MySQL Limits
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045123510176">
</a>
<p>
In this section, we list limits found in NDB Cluster that either
differ from limits found in, or that are not found in, standard
MySQL.
</p>
<a class="indexterm" name="idm46045123508096">
</a>
<a class="indexterm" name="idm46045123506608">
</a>
<a class="indexterm" name="idm46045123505152">
</a>
<a class="indexterm" name="idm46045123503664">
</a>
<a class="indexterm" name="idm46045123502176">
</a>
<p>
<b>
Memory usage and recovery.
</b>
Memory consumed when data is inserted into an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table is not automatically
recovered when deleted, as it is with other storage engines.
Instead, the following rules hold true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement on an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table makes the memory
formerly used by the deleted rows available for re-use by
inserts on the same table only. However, this memory can be
made available for general re-use by performing
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
.
</p>
<p>
A rolling restart of the cluster also frees any memory used
by deleted rows. 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>
.
</p>
</li>
<li class="listitem">
<p>
A
<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>
operation on
an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table frees the memory
that was used by this table for re-use by any
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table, either by the same
table or by another
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Recall that
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
drops and re-creates the table. See
<a class="xref" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
Section 15.1.37, “TRUNCATE TABLE Statement”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
<b>
Limits imposed by the cluster's configuration.
</b>
<a class="indexterm" name="idm46045123481152">
</a>
A number of hard limits exist which are configurable, but
available main memory in the cluster sets limits. See the
complete list of configuration parameters in
<a class="xref" href="mysql-cluster-config-file.html" title="25.4.3 NDB Cluster Configuration Files">
Section 25.4.3, “NDB Cluster Configuration Files”
</a>
. Most
configuration parameters can be upgraded online. These
hard limits include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Database memory size and index memory size
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
,
respectively).
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is
allocated as 32KB pages. As each
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
page
is used, it is assigned to a specific table; once
allocated, this memory cannot be freed except by
dropping the table.
</p>
<p>
See
<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>
, for
more information.
</p>
</li>
<li class="listitem">
<p>
The maximum number of operations that can be performed
per transaction is set using the configuration
parameters
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocaloperations">
<code class="literal">
MaxNoOfLocalOperations
</code>
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Bulk loading,
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
, and
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
are handled as special cases by
running multiple transactions, and so are not subject
to this limitation.
</p>
</div>
</li>
<li class="listitem">
<p>
Different limits related to tables and indexes. For
example, the maximum number of ordered indexes in the
cluster is determined by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and the maximum number of ordered indexes per table is
16.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Node and data object maximums.
</b>
The following limits apply to numbers of cluster nodes and
metadata objects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The maximum number of data nodes is 144. (In NDB 7.6 and
earlier, this was 48.)
</p>
<p>
A data node must have a node ID in the range of 1 to
144, inclusive.
</p>
<p>
Management and API nodes may use node IDs in the range 1
to 255, inclusive.
</p>
</li>
<li class="listitem">
<p>
The total maximum number of nodes in an NDB Cluster is
255. This number includes all SQL nodes (MySQL Servers),
API nodes (applications accessing the cluster other than
MySQL servers), data nodes, and management servers.
</p>
</li>
<li class="listitem">
<p>
The maximum number of metadata objects in current
versions of NDB Cluster is 20320. This limit is
hard-coded.
</p>
</li>
</ul>
</div>
<p>
See
<a class="xref" href="mysql-cluster-limitations-resolved.html" title="25.2.7.11 Previous NDB Cluster Issues Resolved in NDB Cluster 8.4">
Section 25.2.7.11, “Previous NDB Cluster Issues Resolved in NDB Cluster 8.4”
</a>
,
for more information.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/windows-install-archive.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="windows-install-archive">
</a>
2.3.3 Configuration: Manually
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="windows-extract-archive.html">
2.3.3.1 Extracting the Install Archive
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-create-option-file.html">
2.3.3.2 Creating an Option File
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-select-server.html">
2.3.3.3 Selecting a MySQL Server Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-initialize-data-directory.html">
2.3.3.4 Initializing the Data Directory
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-server-first-start.html">
2.3.3.5 Starting the Server for the First Time
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-start-command-line.html">
2.3.3.6 Starting MySQL from the Windows Command Line
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-installation-windows-path.html">
2.3.3.7 Customizing the PATH for MySQL Tools
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-start-service.html">
2.3.3.8 Starting MySQL as a Windows Service
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-testing.html">
2.3.3.9 Testing The MySQL Installation
</a>
</span>
</dt>
</dl>
</div>
<p>
These instructions apply to those
<span class="emphasis">
<em>
not
</em>
</span>
using
the MySQL Configurator application to configure and set up the MySQL
server; or for manually making additional changes. Using MySQL Configurator
is recommended.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/prepare.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="prepare">
</a>
15.5.1 PREPARE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176669488">
</a>
<a class="indexterm" name="idm46045176668416">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87870939"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <em class="replaceable">stmt_name</em> <span class="token keyword">FROM</span> <em class="replaceable">preparable_stmt</em></code></pre>
</div>
<p>
The
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
statement prepares a
SQL statement and assigns it a name,
<em class="replaceable">
<code>
stmt_name
</code>
</em>
, by which to refer to the
statement later. The prepared statement is executed with
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
and released with
<a class="link" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
<code class="literal">
DEALLOCATE PREPARE
</code>
</a>
. For examples,
see
<a class="xref" href="sql-prepared-statements.html" title="15.5 Prepared Statements">
Section 15.5, “Prepared Statements”
</a>
.
</p>
<p>
Statement names are not case-sensitive.
<em class="replaceable">
<code>
preparable_stmt
</code>
</em>
is either a string
literal or a user variable that contains the text of the SQL
statement. The text must represent a single statement, not
multiple statements. Within the statement,
<code class="literal">
?
</code>
characters can be used as parameter markers to indicate where data
values are to be bound to the query later when you execute it. The
<code class="literal">
?
</code>
characters should not be enclosed within
quotation marks, even if you intend to bind them to string values.
Parameter markers can be used only where data values should
appear, not for SQL keywords, identifiers, and so forth.
</p>
<p>
If a prepared statement with the given name already exists, it is
deallocated implicitly before the new statement is prepared. This
means that if the new statement contains an error and cannot be
prepared, an error is returned and no statement with the given
name exists.
</p>
<p>
The scope of a prepared statement is the session within which it
is created, which as several implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A prepared statement created in one session is not available
to other sessions.
</p>
</li>
<li class="listitem">
<p>
When a session ends, whether normally or abnormally, its
prepared statements no longer exist. If auto-reconnect is
enabled, the client is not notified that the connection was
lost. For this reason, clients may wish to disable
auto-reconnect. See
<a class="ulink" href="/doc/c-api/8.4/en/c-api-auto-reconnect.html" target="_top">
Automatic Reconnection Control
</a>
.
</p>
</li>
<li class="listitem">
<p>
A prepared statement created within a stored program continues
to exist after the program finishes executing and can be
executed outside the program later.
</p>
</li>
<li class="listitem">
<p>
A statement prepared in stored program context cannot refer to
stored procedure or function parameters or local variables
because they go out of scope when the program ends and would
be unavailable were the statement to be executed later outside
the program. As a workaround, refer instead to user-defined
variables, which also have session scope; see
<a class="xref" href="user-variables.html" title="11.4 User-Defined Variables">
Section 11.4, “User-Defined Variables”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The type of a parameter used in a prepared statement is determined
when the statement is first prepared; it retains this type
whenever
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
is invoked for
this prepared statement (unless the statement is reprepared, as
explained later in this section). Rules for determining a
parameter's type are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A parameter which is an operand of a binary arithmetic
operator has the same data type as the other operand.
</p>
</li>
<li class="listitem">
<p>
If both operands of a binary arithmetic operator are
parameters, the type of the parameters is decided by the
context of the operator.
</p>
</li>
<li class="listitem">
<p>
If a parameter is the operand of a unary arithmetic operator,
the parameter's type is decided by the context of the
operator.
</p>
</li>
<li class="listitem">
<p>
If an arithmetic operator has no type-determining context, the
derived type for any parameters involved is
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE PRECISION
</code>
</a>
. This can
happen, for example, when the parameter is a top-level node in
a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
list, or when it is
part of a comparison operator.
</p>
</li>
<li class="listitem">
<p>
A parameter which is an operand of a character string operator
has the same derived type as the aggregated type of the other
operands. If all operands of the operator are parameters, the
derived type is
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
; its
collation is determined by the value of
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
A parameter which is an operand of a temporal operator has
type
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
if the operator
returns a
<code class="literal">
DATETIME
</code>
,
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
if the operator returns a
<code class="literal">
TIME
</code>
, and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
if the operator returns a
<code class="literal">
DATE
</code>
.
</p>
</li>
<li class="listitem">
<p>
A parameter which is an operand of a binary comparison
operator has the same derived type as the other operand of the
comparison.
</p>
</li>
<li class="listitem">
<p>
A parameter that is an operand of a ternary comparison
operator such as
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN
</code>
</a>
has the
same derived type as the aggregated type of the other
operands.
</p>
</li>
<li class="listitem">
<p>
If all operands of a comparison operator are parameters, the
derived type for each of them is
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, with collation
determined by the value of
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
A parameter that is an output operand of any of
<a class="link" href="flow-control-functions.html#operator_case">
<code class="literal">
CASE
</code>
</a>
,
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE
</code>
</a>
,
<a class="link" href="flow-control-functions.html#function_if">
<code class="literal">
IF
</code>
</a>
,
<a class="link" href="flow-control-functions.html#function_ifnull">
<code class="literal">
IFNULL
</code>
</a>
, or
<a class="link" href="flow-control-functions.html#function_nullif">
<code class="literal">
NULLIF
</code>
</a>
has the same derived
type as the aggregated type of the operator's other
output operands.
</p>
</li>
<li class="listitem">
<p>
If all output operands of any of
<a class="link" href="flow-control-functions.html#operator_case">
<code class="literal">
CASE
</code>
</a>
,
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE
</code>
</a>
,
<a class="link" href="flow-control-functions.html#function_if">
<code class="literal">
IF
</code>
</a>
,
<a class="link" href="flow-control-functions.html#function_ifnull">
<code class="literal">
IFNULL
</code>
</a>
, or
<a class="link" href="flow-control-functions.html#function_nullif">
<code class="literal">
NULLIF
</code>
</a>
are parameters, or they
are all
<code class="literal">
NULL
</code>
, the type of the parameter is
decided by the context of the operator.
</p>
</li>
<li class="listitem">
<p>
If the parameter is an operand of any of
<a class="link" href="flow-control-functions.html#operator_case">
<code class="literal">
CASE
</code>
</a>
,
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE()
</code>
</a>
,
<a class="link" href="flow-control-functions.html#function_if">
<code class="literal">
IF
</code>
</a>
, or
<a class="link" href="flow-control-functions.html#function_ifnull">
<code class="literal">
IFNULL
</code>
</a>
, and has no
type-determining context, the derived type for each of the
parameters involved is
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
and its collation is determined by the value of
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
A parameter which is the operand of a
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
has the same type as
specified by the
<code class="literal">
CAST()
</code>
.
</p>
</li>
<li class="listitem">
<p>
If a parameter is an immediate member of a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
list that is not part of
an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement, the
derived type of the parameter is
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, and its collation is
determined by the value of
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
If a parameter is an immediate member of a
<code class="literal">
SELECT
</code>
list that is part of an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement, the derived
type of the parameter is the type of the corresponding column
into which the parameter is inserted.
</p>
</li>
<li class="listitem">
<p>
If a parameter is used as source for an assignment in a
<code class="literal">
SET
</code>
clause of an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statement or in the
<code class="literal">
ON DUPLICATE KEY UPDATE
</code>
clause of an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement, the derived
type of the parameter is the type of the corresponding column
which is updated by the
<code class="literal">
SET
</code>
or
<code class="literal">
ON
DUPLICATE KEY UPDATE
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
If a parameter is an argument of a function, the derived type
depends on the function's return type.
</p>
</li>
</ul>
</div>
<p>
For some combinations of actual type and derived type, an
automatic repreparation of the statement is triggered, to ensure
closer compatibility with previous versions of MySQL.
Repreparation does not occur if any of the following conditions
are true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NULL
</code>
is used as the actual parameter value.
</p>
</li>
<li class="listitem">
<p>
A parameter is an operand of a
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
. (Instead, a cast to the
derived type is attempted, and an exception raised if the cast
fails.)
</p>
</li>
<li class="listitem">
<p>
A parameter is a string. (In this case, an implicit
<code class="literal">
CAST(? AS
<em class="replaceable">
<code>
derived_type
</code>
</em>
)
</code>
is
performed.)
</p>
</li>
<li class="listitem">
<p>
The derived type and actual type of the parameter are both
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INTEGER
</code>
</a>
and have the same sign.
</p>
</li>
<li class="listitem">
<p>
The parameter's derived type is
<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 its actual type is
either
<code class="literal">
DECIMAL
</code>
or
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INTEGER
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
The derived type is
<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>
and
the actual type is any numeric type.
</p>
</li>
<li class="listitem">
<p>
Both the derived type and the actual type are string types.
</p>
</li>
<li class="listitem">
<p>
If the derived type is temporal and the actual type is
temporal.
<span class="emphasis">
<em>
Exceptions
</em>
</span>
: The derived type is
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
and the actual type is not
<code class="literal">
TIME
</code>
; the derived type is
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
and the actual type is not
<code class="literal">
DATE
</code>
.
</p>
</li>
<li class="listitem">
<p>
The derived type is temporal and the actual type is numeric.
</p>
</li>
</ul>
</div>
<p>
For cases other than those just listed, the statement is
reprepared and the actual parameter types are used instead of the
derived parameter types.
</p>
<p>
These rules also apply to a user variable referenced in a prepared
statement.
</p>
<p>
Using a different data type for a given parameter or user variable
within a prepared statement for executions of the statement
subsequent to the first execution causes the statement to be
reprepared. This is less efficient; it may also lead to the
parameter's (or variable's) actual type to vary, and
thus for results to be inconsistent, with subsequent executions of
the prepared statement. For these reasons, it is advisable to use
the same data type for a given parameter when re-executing a
prepared statement.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-restrictions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="performance-schema-restrictions">
</a>
29.20 Restrictions on Performance Schema
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045064134240">
</a>
<a class="indexterm" name="idm46045064132736">
</a>
<a class="indexterm" name="idm46045064131232">
</a>
<a class="indexterm" name="idm46045064129728">
</a>
<p>
The Performance Schema avoids using mutexes to collect or produce
data, so there are no guarantees of consistency and results can
sometimes be incorrect. Event values in
<code class="literal">
performance_schema
</code>
tables are nondeterministic
and nonrepeatable.
</p>
<p>
If you save event information in another table, you should not
assume that the original events remain available later. For
example, if you select events from a
<code class="literal">
performance_schema
</code>
table into a temporary
table, intending to join that table with the original table later,
there might be no matches.
</p>
<p>
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
and
<code class="literal">
BACKUP
DATABASE
</code>
ignore tables in the
<code class="literal">
performance_schema
</code>
database.
</p>
<p>
Tables in the
<code class="literal">
performance_schema
</code>
database
cannot be locked with
<code class="literal">
LOCK TABLES
</code>
, except the
<code class="literal">
setup_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables.
</p>
<p>
Tables in the
<code class="literal">
performance_schema
</code>
database
cannot be indexed.
</p>
<p>
Tables in the
<code class="literal">
performance_schema
</code>
database are
not replicated.
</p>
<p>
The types of timers might vary per platform. The
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
table shows which
event timers are available. If the values in this table for a
given timer name are
<code class="literal">
NULL
</code>
, that timer is not
supported on your platform.
</p>
<p>
Instruments that apply to storage engines might not be implemented
for all storage engines. Instrumentation of each third-party
engine is the responsibility of the engine maintainer.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/handler-scope.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="handler-scope">
</a>
15.6.7.6 Scope Rules for Handlers
</h4>
</div>
</div>
</div>
<p>
A stored program may include handlers to be invoked when certain
conditions occur within the program. The applicability of each
handler depends on its location within the program definition
and on the condition or conditions that it handles:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A handler declared in a
<a class="link" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
<code class="literal">
BEGIN ...
END
</code>
</a>
block is in scope only for the SQL statements
following the handler declarations in the block. If the
handler itself raises a condition, it cannot handle that
condition, nor can any other handlers declared in the block.
In the following example, handlers
<code class="literal">
H1
</code>
and
<code class="literal">
H2
</code>
are in scope for conditions raised by
statements
<em class="replaceable">
<code>
stmt1
</code>
</em>
and
<em class="replaceable">
<code>
stmt2
</code>
</em>
. But neither
<code class="literal">
H1
</code>
nor
<code class="literal">
H2
</code>
are in scope
for conditions raised in the body of
<code class="literal">
H1
</code>
or
<code class="literal">
H2
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36095292"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">BEGIN</span> <span class="token comment" spellcheck="true">-- outer block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- handler H1</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- handler H2</span>
<em class="replaceable">stmt1</em><span class="token punctuation">;</span>
<em class="replaceable">stmt2</em><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A handler is in scope only for the block in which it is
declared, and cannot be activated for conditions occurring
outside that block. In the following example, handler
<code class="literal">
H1
</code>
is in scope for
<em class="replaceable">
<code>
stmt1
</code>
</em>
in the inner block, but not
for
<em class="replaceable">
<code>
stmt2
</code>
</em>
in the outer block:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50729143"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">BEGIN</span> <span class="token comment" spellcheck="true">-- outer block</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- inner block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- handler H1</span>
<em class="replaceable">stmt1</em><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<em class="replaceable">stmt2</em><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A handler can be specific or general. A specific handler is
for a MySQL error code,
<code class="literal">
SQLSTATE
</code>
value,
or condition name. A general handler is for a condition in
the
<code class="literal">
SQLWARNING
</code>
,
<code class="literal">
SQLEXCEPTION
</code>
, or
<code class="literal">
NOT
FOUND
</code>
class. Condition specificity is related to
condition precedence, as described later.
</p>
</li>
</ul>
</div>
<p>
Multiple handlers can be declared in different scopes and with
different specificities. For example, there might be a specific
MySQL error code handler in an outer block, and a general
<code class="literal">
SQLWARNING
</code>
handler in an inner block. Or
there might be handlers for a specific MySQL error code and the
general
<code class="literal">
SQLWARNING
</code>
class in the same block.
</p>
<p>
Whether a handler is activated depends not only on its own scope
and condition value, but on what other handlers are present.
When a condition occurs in a stored program, the server searches
for applicable handlers in the current scope (current
<a class="link" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
<code class="literal">
BEGIN ...
END
</code>
</a>
block). If there are no applicable handlers, the
search continues outward with the handlers in each successive
containing scope (block). When the server finds one or more
applicable handlers at a given scope, it chooses among them
based on condition precedence:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A MySQL error code handler takes precedence over an
<code class="literal">
SQLSTATE
</code>
value handler.
</p>
</li>
<li class="listitem">
<p>
An
<code class="literal">
SQLSTATE
</code>
value handler takes
precedence over general
<code class="literal">
SQLWARNING
</code>
,
<code class="literal">
SQLEXCEPTION
</code>
, or
<code class="literal">
NOT
FOUND
</code>
handlers.
</p>
</li>
<li class="listitem">
<p>
An
<code class="literal">
SQLEXCEPTION
</code>
handler takes precedence
over an
<code class="literal">
SQLWARNING
</code>
handler.
</p>
</li>
<li class="listitem">
<p>
It is possible to have several applicable handlers with the
same precedence. For example, a statement could generate
multiple warnings with different error codes, for each of
which an error-specific handler exists. In this case, the
choice of which handler the server activates is
nondeterministic, and may change depending on the
circumstances under which the condition occurs.
</p>
</li>
</ul>
</div>
<p>
One implication of the handler selection rules is that if
multiple applicable handlers occur in different scopes, handlers
with the most local scope take precedence over handlers in outer
scopes, even over those for more specific conditions.
</p>
<p>
If there is no appropriate handler when a condition occurs, the
action taken depends on the class of the condition:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<code class="literal">
SQLEXCEPTION
</code>
conditions, the stored
program terminates at the statement that raised the
condition, as if there were an
<code class="literal">
EXIT
</code>
handler. If the program was called by another stored
program, the calling program handles the condition using the
handler selection rules applied to its own handlers.
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
SQLWARNING
</code>
conditions, the program
continues executing, as if there were a
<code class="literal">
CONTINUE
</code>
handler.
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
NOT FOUND
</code>
conditions, if the
condition was raised normally, the action is
<code class="literal">
CONTINUE
</code>
. If it was raised by
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
or
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
, the action is
<code class="literal">
EXIT
</code>
.
</p>
</li>
</ul>
</div>
<p>
The following examples demonstrate how MySQL applies the handler
selection rules.
</p>
<p>
This procedure contains two handlers, one for the specific
<code class="literal">
SQLSTATE
</code>
value (
<code class="literal">
'42S02'
</code>
)
that occurs for attempts to drop a nonexistent table, and one
for the general
<code class="literal">
SQLEXCEPTION
</code>
class:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80176772"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> p1<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'42S02'</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLSTATE handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLEXCEPTION handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Both handlers are declared in the same block and have the same
scope. However,
<code class="literal">
SQLSTATE
</code>
handlers take
precedence over
<code class="literal">
SQLEXCEPTION
</code>
handlers, so if
the table
<code class="literal">
t
</code>
is nonexistent, the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
statement raises a
condition that activates the
<code class="literal">
SQLSTATE
</code>
handler:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29269255"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> p1<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>
<span class="token output"><span class="token punctuation">|</span> msg <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SQLSTATE handler was activated <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 procedure contains the same two handlers. But this time,
the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
statement and
<code class="literal">
SQLEXCEPTION
</code>
handler are in an inner block
relative to the
<code class="literal">
SQLSTATE
</code>
handler:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6120319"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> p2<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- outer block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'42S02'</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLSTATE handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- inner block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLEXCEPTION handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t<span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- occurs within inner block</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this case, the handler that is more local to where the
condition occurs takes precedence. The
<code class="literal">
SQLEXCEPTION
</code>
handler activates, even though
it is more general than the
<code class="literal">
SQLSTATE
</code>
handler:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61066769"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> p2<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>
<span class="token output"><span class="token punctuation">|</span> msg <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SQLEXCEPTION handler was activated <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 this procedure, one of the handlers is declared in a block
inner to the scope of the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP
TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46245991"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> p3<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- outer block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLEXCEPTION handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- inner block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'42S02'</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLSTATE handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t<span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- occurs within outer block</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Only the
<code class="literal">
SQLEXCEPTION
</code>
handler applies because
the other one is not in scope for the condition raised by the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71144729"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> p3<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>
<span class="token output"><span class="token punctuation">|</span> msg <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SQLEXCEPTION handler was activated <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 this procedure, both handlers are declared in a block inner
to the scope of the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68793350"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> p4<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- outer block</span>
<span class="token keyword">BEGIN</span> <span class="token comment" spellcheck="true">-- inner block</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLEXCEPTION handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'42S02'</span>
<span class="token keyword">SELECT</span> <span class="token string">'SQLSTATE handler was activated'</span> <span class="token keyword">AS</span> msg<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t<span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- occurs within outer block</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Neither handler applies because they are not in scope for the
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
. The condition raised
by the statement goes unhandled and terminates the procedure
with an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32782166"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> p4<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1051 (42S02)<span class="token punctuation">:</span> Unknown table 'test.t'</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/ibd2sdi.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="ibd2sdi">
</a>
6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045308545520">
</a>
<a class="indexterm" name="idm46045308544640">
</a>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
is a utility for extracting
<a class="link" href="glossary.html#glos_serialized_dictionary_information" title="serialized dictionary information (SDI)">
serialized
dictionary information
</a>
(SDI) from
<code class="literal">
InnoDB
</code>
tablespace files. SDI data is present
in all persistent
<code class="literal">
InnoDB
</code>
tablespace files.
</p>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
can be run on
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
tablespace files (
<code class="filename">
*.ibd
</code>
files),
<a class="link" href="glossary.html#glos_general_tablespace" title="general tablespace">
general
tablespace
</a>
files (
<code class="filename">
*.ibd
</code>
files),
<a class="link" href="glossary.html#glos_system_tablespace" title="system tablespace">
system tablespace
</a>
files (
<code class="filename">
ibdata*
</code>
files), and the data
dictionary tablespace (
<code class="filename">
mysql.ibd
</code>
). It is
not supported for use with temporary tablespaces or undo
tablespaces.
</p>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
can be used at runtime or while the
server is offline. During
<a class="link" href="glossary.html#glos_ddl" title="DDL">
DDL
</a>
operations,
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
operations, and undo log purge operations related to SDI, there
may be a short interval of time when
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
fails to read SDI data stored in the tablespace.
</p>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
performs an uncommitted read of SDI
from the specified tablespace. Redo logs and undo logs are not
accessed.
</p>
<p>
Invoke the
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
utility like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93534203"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">file_name1</em> <span class="token punctuation">[</span><em class="replaceable">file_name2 file_name3 <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></em><span class="token punctuation"></span><span class="token punctuation">]</span></code></pre>
</div>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
supports multi-file tablespaces like
the
<code class="literal">
InnoDB
</code>
system tablespace, but it cannot
be run on more than one tablespace at a time. For multi-file
tablespaces, specify each file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa83907022"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi ibdata1 ibdata2</code></pre>
</div>
<p>
The files of a multi-file tablespace must be specified in order
of the ascending page number. If two successive files have the
same space ID, the later file must start with the last page
number of the previous file + 1.
</p>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
outputs SDI (containing id, type, and
data fields) in
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
format.
</p>
<h4>
<a name="idm46045308519136">
</a>
ibd2sdi Options
</h4>
<p>
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
supports the following options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ibd2sdi_help">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_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>
<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="idm46045308505216">
</a>
<a class="indexterm" name="idm46045308503824">
</a>
<p>
Display a help message and exit. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa11473682"><div class="copy-help left">Press ⌘+C to 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">Usage<span class="token punctuation">:</span> <span class="token punctuation">.</span>/ibd2sdi <span class="token punctuation">[</span><span class="token property">-v</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token property">-c</span> <strict-check><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token property">-d</span> <dump file name><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token property">-n</span><span class="token punctuation">]</span> filename1 <span class="token punctuation">[</span>filenames<span class="token punctuation">]</span>
See http<span class="token punctuation">:</span>//dev<span class="token punctuation">.</span>mysql<span class="token punctuation">.</span>com/doc/refman/8<span class="token punctuation">.</span>4/en/ibd2sdi<span class="token punctuation">.</span>html for usage hints<span class="token punctuation">.</span>
<span class="token property">-h,</span> <span class="token property">--help</span> Display this help and exit<span class="token punctuation">.</span>
<span class="token property">-v,</span> <span class="token property">--version</span> Display version information and exit<span class="token punctuation">.</span>
-<span class="token comment" spellcheck="true">#, --debug[=name] Output debug log. See</span>
http<span class="token punctuation">:</span>//dev<span class="token punctuation">.</span>mysql<span class="token punctuation">.</span>com/doc/refman/8<span class="token punctuation">.</span>4/en/dbug-package<span class="token punctuation">.</span>html
<span class="token property">-d,</span> <span class="token constant">--dump-file</span><span class="token attr-value"><span class="token punctuation">=</span>name</span>
Dump the tablespace SDI into the file passed by user<span class="token punctuation">.</span>
Without the filename<span class="token punctuation">,</span> it will default to stdout
<span class="token property">-s,</span> <span class="token property">--skip-data</span> Skip retrieving data from SDI records<span class="token punctuation">.</span> Retrieve only id
and type<span class="token punctuation">.</span>
<span class="token property">-i,</span> <span class="token constant">--id</span><span class="token attr-value"><span class="token punctuation">=</span>#</span> Retrieve the SDI record matching the id passed by user<span class="token punctuation">.</span>
<span class="token property">-t,</span> <span class="token constant">--type</span><span class="token attr-value"><span class="token punctuation">=</span>#</span> Retrieve the SDI records matching the type passed by
user<span class="token punctuation">.</span>
<span class="token property">-c,</span> <span class="token constant">--strict-check</span><span class="token attr-value"><span class="token punctuation">=</span>name</span>
Specify the strict checksum algorithm by the user<span class="token punctuation">.</span>
Allowed values are innodb<span class="token punctuation">,</span> crc32<span class="token punctuation">,</span> none<span class="token punctuation">.</span>
<span class="token property">-n,</span> <span class="token property">--no-check</span> Ignore the checksum verification<span class="token punctuation">.</span>
<span class="token property">-p,</span> <span class="token property">--pretty</span> Pretty format the SDI output<span class="token punctuation">.</span>If false<span class="token punctuation">,</span> SDI would be not
human readable but it will be of less size
<span class="token punctuation">(</span>Defaults to on<span class="token punctuation">;</span> use <span class="token property">--skip-pretty</span> to disable<span class="token punctuation">.</span><span class="token punctuation">)</span>
Variables <span class="token punctuation">(</span><span class="token constant">--variable-name</span><span class="token attr-value"><span class="token punctuation">=</span>value)</span>
and boolean options <span class="token punctuation">{</span>FALSE|TRUE<span class="token punctuation">}</span> Value <span class="token punctuation">(</span>after reading options<span class="token punctuation">)</span>
<span class="token property">---------------------------------</span> <span class="token property">----------------------------------------</span>
debug <span class="token punctuation">(</span>No default value<span class="token punctuation">)</span>
dump-file <span class="token punctuation">(</span>No default value<span class="token punctuation">)</span>
skip-data FALSE
id 0
type 0
strict-check crc32
no-check FALSE
pretty TRUE</code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_version">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_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>
<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="idm46045308487040">
</a>
<a class="indexterm" name="idm46045308485648">
</a>
<p>
Display version information and exit. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93832341"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi Ver 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3 for Linux on x86_64 <span class="token punctuation">(</span>Source distribution<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_debug">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_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=options
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045308470272">
</a>
<a class="indexterm" name="idm46045308468880">
</a>
<p>
Prints a debug log. For debug options, refer to
<a class="xref" href="dbug-package.html" title="7.9.4 The DBUG Package">
Section 7.9.4, “The DBUG Package”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa11001849"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token constant">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d:t</span> /tmp/ibd2sdi<span class="token punctuation">.</span>trace</code></pre>
</div>
<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_ibd2sdi_dump-file">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_dump-file">
<code class="option">
--dump-file=
</code>
</a>
,
<code class="option">
-d
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for dump-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--dump-file=file
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045308452160">
</a>
<a class="indexterm" name="idm46045308450768">
</a>
<p>
Dumps serialized dictionary information (SDI) into the
specified dump file. If a dump file is not specified, the
tablespace SDI is dumped to
<code class="literal">
stdout
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28823849"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token constant">--dump-file</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em></span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_skip-data">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_skip-data">
<code class="option">
--skip-data
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-data">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-data
</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="idm46045308435136">
</a>
<a class="indexterm" name="idm46045308433744">
</a>
<p>
Skips retrieval of
<code class="literal">
data
</code>
field values from
the serialized dictionary information (SDI) and only
retrieves the
<code class="literal">
id
</code>
and
<code class="literal">
type
</code>
field values, which are primary keys
for SDI records.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa6985906"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi</span> <span class="token property">--skip-data</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd
<span class="token inlinejson"><span class="token punctuation">[</span><span class="token string">"ibd2sdi"</span>
<span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"id"</span><span class="token operator">:</span> <span class="token number">330</span>
<span class="token punctuation">}</span>
<span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
<span class="token property">"id"</span><span class="token operator">:</span> <span class="token number">7</span>
<span class="token punctuation">}</span>
<span class="token punctuation">]</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_id">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_id">
<code class="option">
--id=
<em class="replaceable">
<code>
#
</code>
</em>
</code>
</a>
,
<code class="option">
-i
<em class="replaceable">
<code>
#
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for id">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--id=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045308415040">
</a>
<a class="indexterm" name="idm46045308413552">
</a>
<p>
Retrieves serialized dictionary information (SDI) matching
the specified table or tablespace object id. An object id is
unique to the object type. Table and tablespace object IDs
are also found in the
<code class="literal">
id
</code>
column of the
<code class="literal">
mysql.tables
</code>
and
<code class="literal">
mysql.tablespace
</code>
data dictionary tables.
For information about data dictionary tables, see
<a class="xref" href="data-dictionary-schema.html" title="16.1 Data Dictionary Schema">
Section 16.1, “Data Dictionary Schema”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa44137599"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi</span> <span class="token constant">--id</span><span class="token attr-value"><span class="token punctuation">=</span>7</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd
<span class="token inlinejson"><span class="token punctuation">[</span><span class="token string">"ibd2sdi"</span>
<span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
<span class="token property">"id"</span><span class="token operator">:</span> <span class="token number">7</span><span class="token punctuation">,</span>
<span class="token property">"object"</span><span class="token operator">:</span>
<span class="token punctuation">{</span>
<span class="token property">"mysqld_version_id"</span><span class="token operator">:</span> <span class="token number">80003</span><span class="token punctuation">,</span>
<span class="token property">"dd_version"</span><span class="token operator">:</span> <span class="token number">80003</span><span class="token punctuation">,</span>
<span class="token property">"sdi_version"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"dd_object_type"</span><span class="token operator">:</span> <span class="token string">"Tablespace"</span><span class="token punctuation">,</span>
<span class="token property">"dd_object"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"test/t1"</span><span class="token punctuation">,</span>
<span class="token property">"comment"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span>
<span class="token property">"options"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span>
<span class="token property">"se_private_data"</span><span class="token operator">:</span> <span class="token string">"flags=16417;id=2;server_version=80003;space_version=1;"</span><span class="token punctuation">,</span>
<span class="token property">"engine"</span><span class="token operator">:</span> <span class="token string">"InnoDB"</span><span class="token punctuation">,</span>
<span class="token property">"files"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token punctuation">{</span>
<span class="token property">"ordinal_position"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"filename"</span><span class="token operator">:</span> <span class="token string">"./test/t1.ibd"</span><span class="token punctuation">,</span>
<span class="token property">"se_private_data"</span><span class="token operator">:</span> <span class="token string">"id=2;"</span>
<span class="token punctuation">}</span>
<span class="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>
<a name="option_ibd2sdi_type">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_type">
<code class="option">
--type=
<em class="replaceable">
<code>
#
</code>
</em>
</code>
</a>
,
<code class="option">
-t
<em class="replaceable">
<code>
#
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for type">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--type=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
1
</code>
</p>
<p class="valid-value">
<code class="literal">
2
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045308389248">
</a>
<a class="indexterm" name="idm46045308387760">
</a>
<p>
Retrieves serialized dictionary information (SDI) matching
the specified object type. SDI is provided for table
(type=1) and tablespace (type=2) objects.
</p>
<p>
This example shows output for a tablespace
<code class="literal">
ts1
</code>
in the
<code class="literal">
test
</code>
database:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa82967421"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi</span> <span class="token constant">--type</span><span class="token attr-value"><span class="token punctuation">=</span>2</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/ts1<span class="token punctuation">.</span>ibd
<span class="token inlinejson"><span class="token punctuation">[</span><span class="token string">"ibd2sdi"</span>
<span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
<span class="token property">"id"</span><span class="token operator">:</span> <span class="token number">7</span><span class="token punctuation">,</span>
<span class="token property">"object"</span><span class="token operator">:</span>
<span class="token punctuation">{</span>
<span class="token property">"mysqld_version_id"</span><span class="token operator">:</span> <span class="token number">80003</span><span class="token punctuation">,</span>
<span class="token property">"dd_version"</span><span class="token operator">:</span> <span class="token number">80003</span><span class="token punctuation">,</span>
<span class="token property">"sdi_version"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"dd_object_type"</span><span class="token operator">:</span> <span class="token string">"Tablespace"</span><span class="token punctuation">,</span>
<span class="token property">"dd_object"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"test/ts1"</span><span class="token punctuation">,</span>
<span class="token property">"comment"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span>
<span class="token property">"options"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span>
<span class="token property">"se_private_data"</span><span class="token operator">:</span> <span class="token string">"flags=16417;id=2;server_version=80003;space_version=1;"</span><span class="token punctuation">,</span>
<span class="token property">"engine"</span><span class="token operator">:</span> <span class="token string">"InnoDB"</span><span class="token punctuation">,</span>
<span class="token property">"files"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token punctuation">{</span>
<span class="token property">"ordinal_position"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"filename"</span><span class="token operator">:</span> <span class="token string">"./test/ts1.ibd"</span><span class="token punctuation">,</span>
<span class="token property">"se_private_data"</span><span class="token operator">:</span> <span class="token string">"id=2;"</span>
<span class="token punctuation">}</span>
<span class="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>
Due to the way in which
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
handles default value metadata, a default value may be
present and non-empty in
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
output
for a given table column even if it is not defined using
<code class="literal">
DEFAULT
</code>
. Consider the two tables created
using the following statements, in the database named
<code class="literal">
i
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34259927"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">16</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 punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">"Sakila"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Using
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
, we can see that the
<code class="literal">
default_value
</code>
for column
<code class="literal">
c
</code>
is nonempty and is in fact padded to
length in both tables, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa60221686"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/i/t1<span class="token punctuation">.</span>ibd | grep <span class="token property">-m1</span> <span class="token atrule">'\"default_value\"'</span> | cut <span class="token property">-b34-</span> | sed <span class="token property">-e</span> s/<span class="token punctuation">,</span>//
<span class="token atrule">"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="</span>
<span class="token prompt">$> </span><span class="token command">ibd2sdi</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/i/t2<span class="token punctuation">.</span>ibd | grep <span class="token property">-m1</span> <span class="token atrule">'\"default_value\"'</span> | cut <span class="token property">-b34-</span> | sed <span class="token property">-e</span> s/<span class="token punctuation">,</span>//
<span class="token atrule">"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="</span></code></pre>
</div>
<p>
Examination of
<a class="link" href="ibd2sdi.html" title="6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility">
<span class="command">
<strong>
ibd2sdi
</strong>
</span>
</a>
output may be
easier using a JSON-aware utility like
<span class="command">
<strong>
<a class="ulink" href="https://stedolan.github.io/jq/" target="_blank">
jq
</a>
</strong>
</span>
,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa2431820"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/i/t1<span class="token punctuation">.</span>ibd | jq <span class="token atrule">'.[1]["object"]["dd_object"]["columns"][0]["default_value"]'</span>
<span class="token atrule">"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="</span>
<span class="token prompt">$> </span><span class="token command">ibd2sdi</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/i/t2<span class="token punctuation">.</span>ibd | jq <span class="token atrule">'.[1]["object"]["dd_object"]["columns"][0]["default_value"]'</span>
<span class="token atrule">"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="</span></code></pre>
</div>
<p>
For more information, see the
<a class="ulink" href="/doc/dev/mysql-server/latest/" target="_top">
MySQL
Internals documentation
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_strict-check">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_strict-check">
<code class="option">
--strict-check
</code>
</a>
,
<code class="option">
-c
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for strict-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--strict-check=algorithm
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
crc32
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
crc32
</code>
</p>
<p class="valid-value">
<code class="literal">
innodb
</code>
</p>
<p class="valid-value">
<code class="literal">
none
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045308345184">
</a>
<a class="indexterm" name="idm46045308343696">
</a>
<p>
Specifies a strict checksum algorithm for validating the
checksum of pages that are read. Options include
<code class="literal">
innodb
</code>
,
<code class="literal">
crc32
</code>
, and
<code class="literal">
none
</code>
.
</p>
<p>
In this example, the strict version of the
<code class="literal">
innodb
</code>
checksum algorithm is specified:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31624709"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token constant">--strict-check</span><span class="token attr-value"><span class="token punctuation">=</span>innodb</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
<p>
In this example, the strict version of
<code class="literal">
crc32
</code>
checksum algorithm is specified:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa16096956"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token property">-c</span> crc32 <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
<p>
If you do not specify the
<a class="link" href="ibd2sdi.html#option_ibd2sdi_strict-check">
<code class="option">
--strict-check
</code>
</a>
option,
validation is performed against non-strict
<code class="literal">
innodb
</code>
,
<code class="literal">
crc32
</code>
and
<code class="literal">
none
</code>
checksums.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_no-check">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_no-check">
<code class="option">
--no-check
</code>
</a>
,
<code class="option">
-n
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-check
</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="idm46045308318832">
</a>
<a class="indexterm" name="idm46045308317344">
</a>
<p>
Skips checksum validation for pages that are read.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa16943936"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token property">--no-check</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ibd2sdi_pretty">
</a>
<a class="link" href="ibd2sdi.html#option_ibd2sdi_pretty">
<code class="option">
--pretty
</code>
</a>
,
<code class="option">
-p
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for pretty">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--pretty
</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="idm46045308301744">
</a>
<a class="indexterm" name="idm46045308300256">
</a>
<p>
Outputs SDI data in JSON pretty print format. Enabled by
default. If disabled, SDI is not human readable but is
smaller in size. Use
<code class="literal">
--skip-pretty
</code>
to
disable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa74950025"><div class="copy-help left">Press ⌘+C to 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">ibd2sdi <span class="token property">--skip-pretty</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>/data/test/t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connector-nodejs-info.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="connector-nodejs-info">
</a>
31.6 MySQL Connector/Node.js
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060356064">
</a>
<a class="indexterm" name="idm46045060355024">
</a>
<p>
The MySQL Connector/Node.js manual is published in standalone form,
not as part of the MySQL Reference Manual. For information, see
these documents:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Release notes:
<a class="ulink" href="/doc/relnotes/connector-nodejs/en/" target="_top">
MySQL
Connector/Node.js Release Notes
</a>
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-collations-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-collations-table">
</a>
28.3.6 The INFORMATION_SCHEMA COLLATIONS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080297392">
</a>
<p>
The
<a class="link" href="information-schema-collations-table.html" title="28.3.6 The INFORMATION_SCHEMA COLLATIONS Table">
<code class="literal">
COLLATIONS
</code>
</a>
table provides
information about collations for each character set.
</p>
<p>
The
<a class="link" href="information-schema-collations-table.html" title="28.3.6 The INFORMATION_SCHEMA COLLATIONS Table">
<code class="literal">
COLLATIONS
</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">
COLLATION_NAME
</code>
</p>
<p>
The collation name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_SET_NAME
</code>
</p>
<p>
The name of the character set with which the collation is
associated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ID
</code>
</p>
<p>
The collation ID.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_DEFAULT
</code>
</p>
<p>
Whether the collation is the default for its character set.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_COMPILED
</code>
</p>
<p>
Whether the character set is compiled into the server.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SORTLEN
</code>
</p>
<p>
This is related to the amount of memory required to sort
strings expressed in the character set.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAD_ATTRIBUTE
</code>
</p>
<p>
The collation pad attribute, either
<code class="literal">
NO PAD
</code>
or
<code class="literal">
PAD SPACE
</code>
. This attribute affects
whether trailing spaces are significant in string comparisons;
see
<a class="xref" href="charset-binary-collations.html#charset-binary-collations-trailing-space-comparisons" title="Trailing Space Handling in Comparisons">
Trailing Space Handling in Comparisons
</a>
.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045080276256">
</a>
Notes
</h4>
<p>
Collation information is also available from the
<a class="link" href="show-collation.html" title="15.7.7.5 SHOW COLLATION Statement">
<code class="literal">
SHOW COLLATION
</code>
</a>
statement. See
<a class="xref" href="show-collation.html" title="15.7.7.5 SHOW COLLATION Statement">
Section 15.7.7.5, “SHOW COLLATION Statement”
</a>
. The following statements are
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27068135"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> COLLATION_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>COLLATIONS
<span class="token punctuation">[</span><span class="token keyword">WHERE</span> COLLATION_NAME <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">COLLATION</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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-wait-classes-global-by-latency.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-wait-classes-global-by-latency">
</a>
30.4.3.49 The wait_classes_global_by_latency and x$wait_classes_global_by_latency
Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061768112">
</a>
<a class="indexterm" name="idm46045061766656">
</a>
<a class="indexterm" name="idm46045061765152">
</a>
<a class="indexterm" name="idm46045061763648">
</a>
<p>
These views summarize wait class total latencies, grouped by
event class. By default, rows are sorted by descending total
latency. Idle events are ignored.
</p>
<p>
An event class is determined by stripping from the event name
everything after the first three components. For example, the
class for
<code class="literal">
wait/io/file/sql/slow_log
</code>
is
<code class="literal">
wait/io/file
</code>
.
</p>
<p>
The
<a class="link" href="sys-wait-classes-global-by-latency.html" title="30.4.3.49 The wait_classes_global_by_latency and x$wait_classes_global_by_latency Views">
<code class="literal">
wait_classes_global_by_latency
</code>
</a>
and
<a class="link" href="sys-wait-classes-global-by-latency.html" title="30.4.3.49 The wait_classes_global_by_latency and x$wait_classes_global_by_latency Views">
<code class="literal">
x$wait_classes_global_by_latency
</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">
event_class
</code>
</p>
<p>
The event class.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
The total number of occurrences of events in the class.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of events in the
class.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
min_latency
</code>
</p>
<p>
The minimum single wait time of timed occurrences of
events in the class.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed occurrence of events in
the class.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_latency
</code>
</p>
<p>
The maximum single wait time of timed occurrences of
events in the class.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log-destination-configuration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-log-destination-configuration">
</a>
7.4.2.2 Default Error Log Destination Configuration
</h4>
</div>
</div>
</div>
<p>
This section describes which server options configure the
default error log destination, which can be the console or a
named file. It also indicates which log sink components base
their own output destination on the default destination.
</p>
<p>
In this discussion,
<span class="quote">
“
<span class="quote">
console
</span>
”
</span>
means
<code class="literal">
stderr
</code>
, the standard error output. This is
your terminal or console window unless the standard error output
has been redirected to a different destination.
</p>
<p>
The server interprets options that determine the default error
log destination somewhat differently for Windows and Unix
systems. Be sure to configure the destination using the
information appropriate to your platform. After the server
interprets the default error log destination options, it sets
the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
system variable
to indicate the default destination, which affects where several
log sink components write error messages. The following sections
address these topics.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="error-log-destination-configuration.html#error-log-destination-configuration-windows" title="Default Error Log Destination on Windows">
Default Error Log Destination on Windows
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-log-destination-configuration.html#error-log-destination-configuration-unix" title="Default Error Log Destination on Unix and Unix-Like Systems">
Default Error Log Destination on Unix and Unix-Like Systems
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="error-log-destination-configuration.html#error-log-destination-sink-effects" title="How the Default Error Log Destination Affects Log Sinks">
How the Default Error Log Destination Affects Log Sinks
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-destination-configuration-windows">
</a>
Default Error Log Destination on Windows
</h5>
</div>
</div>
</div>
<p>
On Windows,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
uses the
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
,
<a class="link" href="server-system-variables.html#sysvar_pid_file">
<code class="option">
--pid-file
</code>
</a>
, and
<a class="link" href="server-options.html#option_mysqld_console">
<code class="option">
--console
</code>
</a>
options to determine
whether the default error log destination is the console or a
file, and, if a file, the file name:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_console">
<code class="option">
--console
</code>
</a>
is given, the
default destination is the console.
(
<a class="link" href="server-options.html#option_mysqld_console">
<code class="option">
--console
</code>
</a>
takes precedence
over
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
if both
are given, and the following items regarding
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
do not apply.)
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is not
given, or is given without naming a file, the default
destination is a file named
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
in the data directory, unless the
<a class="link" href="server-system-variables.html#sysvar_pid_file">
<code class="option">
--pid-file
</code>
</a>
option is
specified. In that case, the file name is the PID file
base name with a suffix of
<code class="filename">
.err
</code>
in
the data directory.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is given to
name a file, the default destination is that file (with an
<code class="filename">
.err
</code>
suffix added if the name has no
suffix). The file location is under the data directory
unless an absolute path name is given to specify a
different location.
</p>
</li>
</ul>
</div>
<p>
If the default error log destination is the console, the
server sets the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
system variable to
<code class="literal">
stderr
</code>
. Otherwise, the
default destination is a file and the server sets
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
to the file name.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-destination-configuration-unix">
</a>
Default Error Log Destination on Unix and Unix-Like Systems
</h5>
</div>
</div>
</div>
<p>
On Unix and Unix-like systems,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
uses
the
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
option to
determine whether the default error log destination is the
console or a file, and, if a file, the file name:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is not
given, the default destination is the console.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is given
without naming a file, the default destination is a file
named
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
in the data directory.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is given to
name a file, the default destination is that file (with an
<code class="filename">
.err
</code>
suffix added if the name has no
suffix). The file location is under the data directory
unless an absolute path name is given to specify a
different location.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
is given in
an option file in a
<code class="literal">
[mysqld]
</code>
,
<code class="literal">
[server]
</code>
, or
<code class="literal">
[mysqld_safe]
</code>
section, on systems that
use
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
to start the server,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
finds and uses the option,
and passes it to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is common for Yum or APT package installations to
configure an error log file location under
<code class="filename">
/var/log
</code>
with an option like
<code class="literal">
log-error=/var/log/mysqld.log
</code>
in a server
configuration file. Removing the path name from the option
causes the
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
file in the data directory to be used.
</p>
</div>
<p>
If the default error log destination is the console, the
server sets the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
system variable to
<code class="literal">
stderr
</code>
. Otherwise, the
default destination is a file and the server sets
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
to the file name.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="error-log-destination-sink-effects">
</a>
How the Default Error Log Destination Affects Log Sinks
</h5>
</div>
</div>
</div>
<p>
After the server interprets the error log destination
configuration options, it sets the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
system variable to
indicate the default error log destination. Log sink
components may base their own output destination on the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
value, or determine
their destination independently of
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
</p>
<p>
If
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
is
<code class="literal">
stderr
</code>
, the default error log destination
is the console, and log sinks that base their output
destination on the default destination also write to the
console:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
log_sink_internal
</code>
,
<code class="literal">
log_sink_json
</code>
,
<code class="literal">
log_sink_test
</code>
: These sinks write to the
console. This is true even for sinks such as
<code class="literal">
log_sink_json
</code>
that can be enabled
multiple times; all instances write to the console.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_sink_syseventlog
</code>
: This sink writes
to the system log, regardless of the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
value.
</p>
</li>
</ul>
</div>
<p>
If
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
is not
<code class="literal">
stderr
</code>
, the default error log destination
is a file and
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
indicates the file name. Log sinks that base their output
destination on the default destination base output file naming
on that file name. (A sink might use exactly that name, or it
might use some variant thereof.) Suppose that the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
value
<em class="replaceable">
<code>
file_name
</code>
</em>
. Then log sinks use the
name like this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
log_sink_internal
</code>
,
<code class="literal">
log_sink_test
</code>
: These sinks write to
<em class="replaceable">
<code>
file_name
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_sink_json
</code>
: Successive instances of
this sink named in the
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
value
write to files named
<em class="replaceable">
<code>
file_name
</code>
</em>
plus a numbered
<code class="filename">
.
<em class="replaceable">
<code>
NN
</code>
</em>
.json
</code>
suffix:
<code class="filename">
<em class="replaceable">
<code>
file_name
</code>
</em>
.00.json
</code>
,
<code class="filename">
<em class="replaceable">
<code>
file_name
</code>
</em>
.01.json
</code>
,
and so forth.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_sink_syseventlog
</code>
: This sink writes
to the system log, regardless of the
<a class="link" href="server-system-variables.html#sysvar_log_error">
<code class="literal">
log_error
</code>
</a>
value.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqld-safe.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysqld-safe">
</a>
6.3.2 mysqld_safe — MySQL Server Startup Script
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045322000112">
</a>
<a class="indexterm" name="idm46045321999200">
</a>
<a class="indexterm" name="idm46045321997840">
</a>
<p>
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
is the recommended way to start a
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server on Unix.
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
adds some safety features such as
restarting the server when an error occurs and logging runtime
information to an error log. A description of error logging is
given later in this section.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For some Linux platforms, MySQL installation from RPM or
Debian packages includes systemd support for managing MySQL
server startup and shutdown. On these platforms,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
is not installed because it is
unnecessary. For more information, 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>
.
</p>
<p>
One implication of the non-use of
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
on platforms that use systemd
for server management is that use of
<code class="literal">
[mysqld_safe]
</code>
or
<code class="literal">
[safe_mysqld]
</code>
sections in option files is
not supported and might lead to unexpected behavior.
</p>
</div>
<p>
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
tries to start an executable
named
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. To override the default
behavior and specify explicitly the name of the server you want
to run, specify a
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld">
<code class="option">
--mysqld
</code>
</a>
or
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-version">
<code class="option">
--mysqld-version
</code>
</a>
option
to
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
. You can also use
<a class="link" href="mysqld-safe.html#option_mysqld_safe_ledir">
<code class="option">
--ledir
</code>
</a>
to indicate the
directory where
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
should look for
the server.
</p>
<p>
Many of the options to
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
are the
same as the options to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. See
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
.
</p>
<p>
Options unknown to
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
are passed to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
if they are specified on the command
line, but ignored if they are specified in the
<code class="literal">
[mysqld_safe]
</code>
group of an option file. See
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<p>
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
reads all options from the
<code class="literal">
[mysqld]
</code>
,
<code class="literal">
[server]
</code>
, and
<code class="literal">
[mysqld_safe]
</code>
sections in option files. For
example, if you specify a
<code class="literal">
[mysqld]
</code>
section
like this,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
finds and uses the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa51435975"><div class="copy-help left">Press ⌘+C to 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">log-error</span><span class="token attr-value"><span class="token punctuation">=</span>error.log</span></code></pre>
</div>
<p>
For backward compatibility,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
also
reads
<code class="literal">
[safe_mysqld]
</code>
sections, but to be
current you should rename such sections to
<code class="literal">
[mysqld_safe]
</code>
.
</p>
<p>
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
accepts options on the command
line and in option files, as described in the following table.
For information about option files used by MySQL programs, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<div class="table">
<a name="idm46045321956432">
</a>
<p class="title">
<b>
Table 6.7 mysqld_safe Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for mysqld_safe.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_basedir">
--basedir
</a>
</td>
<td>
Path to MySQL installation directory
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_core-file-size">
--core-file-size
</a>
</td>
<td>
Size of core file that mysqld should be able to create
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_datadir">
--datadir
</a>
</td>
<td>
Path to data directory
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_defaults-extra-file">
--defaults-extra-file
</a>
</td>
<td>
Read named option file in addition to usual option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_help">
--help
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_ledir">
--ledir
</a>
</td>
<td>
Path to directory where server is located
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
--log-error
</a>
</td>
<td>
Write error log to named file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
--malloc-lib
</a>
</td>
<td>
Alternative malloc library to use for mysqld
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld">
--mysqld
</a>
</td>
<td>
Name of server program to start (in ledir directory)
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-safe-log-timestamps">
--mysqld-safe-log-timestamps
</a>
</td>
<td>
Timestamp format for logging
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-version">
--mysqld-version
</a>
</td>
<td>
Suffix for server program name
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_nice">
--nice
</a>
</td>
<td>
Use nice program to set server scheduling priority
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_open-files-limit">
--open-files-limit
</a>
</td>
<td>
Number of files that mysqld should be able to open
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_pid-file">
--pid-file
</a>
</td>
<td>
Path name of server process ID file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_plugin-dir">
--plugin-dir
</a>
</td>
<td>
Directory where plugins are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_port">
--port
</a>
</td>
<td>
Port number on which to listen for TCP/IP connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_skip-kill-mysqld">
--skip-kill-mysqld
</a>
</td>
<td>
Do not try to kill stray mysqld processes
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
--skip-syslog
</a>
</td>
<td>
Do not write error messages to syslog; use error log file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_socket">
--socket
</a>
</td>
<td>
Socket file on which to listen for Unix socket connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
--syslog
</a>
</td>
<td>
Write error messages to syslog
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog-tag">
--syslog-tag
</a>
</td>
<td>
Tag suffix for messages written to syslog
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_timezone">
--timezone
</a>
</td>
<td>
Set TZ time zone environment variable to named value
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_user">
--user
</a>
</td>
<td>
Run mysqld as user having name user_name or numeric user ID user_id
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 719px;">
<thead>
<tr>
<th style="width: 253.766px;">
Option Name
</th>
<th style="width: 464.047px;">
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">
<p>
<a name="option_mysqld_safe_help">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_help">
<code class="option">
--help
</code>
</a>
</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="idm46045321881040">
</a>
<a class="indexterm" name="idm46045321879648">
</a>
<p>
Display a help message and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_basedir">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_basedir">
<code class="option">
--basedir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for basedir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--basedir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321868480">
</a>
<a class="indexterm" name="idm46045321867088">
</a>
<p>
The path to the MySQL installation directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_core-file-size">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_core-file-size">
<code class="option">
--core-file-size=
<em class="replaceable">
<code>
size
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for core-file-size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--core-file-size=size
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321855920">
</a>
<a class="indexterm" name="idm46045321854528">
</a>
<p>
The size of the core file that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
should be able to create. The option value is passed to
<span class="command">
<strong>
ulimit -c
</strong>
</span>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
<code class="literal">
innodb_buffer_pool_in_core_file
</code>
</a>
variable can be used to reduce the size of core files on
operating systems that support it. For more information,
see
<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>
.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_datadir">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_datadir">
<code class="option">
--datadir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for datadir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--datadir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321839296">
</a>
<a class="indexterm" name="idm46045321837904">
</a>
<p>
The path to the data directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_defaults-extra-file">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_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="idm46045321826816">
</a>
<a class="indexterm" name="idm46045321825424">
</a>
<p>
Read this option file in addition to the usual option files.
If the file does not exist or is otherwise inaccessible, the
server exits with an error. If
<em class="replaceable">
<code>
file_name
</code>
</em>
is not an absolute path
name, it is interpreted relative to the current directory.
This must be the first option on the command line if it is
used.
</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_mysqld_safe_defaults-file">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_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="idm46045321812528">
</a>
<a class="indexterm" name="idm46045321811136">
</a>
<p>
Use only the given option file. If the file does not exist
or is otherwise inaccessible, the server exits with an
error. If
<em class="replaceable">
<code>
file_name
</code>
</em>
is not an
absolute path name, it is interpreted relative to the
current directory. This must be the first option on the
command line if it is used.
</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_mysqld_safe_ledir">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_ledir">
<code class="option">
--ledir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ledir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ledir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321798288">
</a>
<a class="indexterm" name="idm46045321796896">
</a>
<p>
If
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
cannot find the server,
use this option to indicate the path name to the directory
where the server is located.
</p>
<p>
This option is accepted only on the command line, not in
option files. On platforms that use systemd, the value can
be specified in the value of
<code class="literal">
MYSQLD_OPTS
</code>
.
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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_log-error">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for log-error">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--log-error=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321782960">
</a>
<a class="indexterm" name="idm46045321781568">
</a>
<p>
Write the error log to the given file. See
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_mysqld-safe-log-timestamps">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-safe-log-timestamps">
<code class="option">
--mysqld-safe-log-timestamps
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for mysqld-safe-log-timestamps">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--mysqld-safe-log-timestamps=type
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
utc
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
system
</code>
</p>
<p class="valid-value">
<code class="literal">
hyphen
</code>
</p>
<p class="valid-value">
<code class="literal">
legacy
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321763360">
</a>
<a class="indexterm" name="idm46045321761968">
</a>
<p>
This option controls the format for timestamps in log output
produced by
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
. The following
list describes the permitted values. For any other value,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
logs a warning and uses
<code class="literal">
UTC
</code>
format.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
UTC
</code>
,
<code class="literal">
utc
</code>
</p>
<p>
ISO 8601 UTC format (same as
<a class="link" href="server-system-variables.html#sysvar_log_timestamps">
<code class="option">
--log_timestamps=UTC
</code>
</a>
for
the server). This is the default.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SYSTEM
</code>
,
<code class="literal">
system
</code>
</p>
<p>
ISO 8601 local time format (same as
<a class="link" href="server-system-variables.html#sysvar_log_timestamps">
<code class="option">
--log_timestamps=SYSTEM
</code>
</a>
for the server).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HYPHEN
</code>
,
<code class="literal">
hyphen
</code>
</p>
<p>
<em class="replaceable">
<code>
YY-MM-DD h:mm:ss
</code>
</em>
format, as
in
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
for MySQL 5.6.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LEGACY
</code>
,
<code class="literal">
legacy
</code>
</p>
<p>
<em class="replaceable">
<code>
YYMMDD hh:mm:ss
</code>
</em>
format, as in
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
prior to MySQL 5.6.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_malloc-lib">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib=[
<em class="replaceable">
<code>
lib_name
</code>
</em>
]
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for malloc-lib">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--malloc-lib=[lib-name]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321733440">
</a>
<a class="indexterm" name="idm46045321732048">
</a>
<a class="indexterm" name="idm46045321730656">
</a>
<p>
The name of the library to use for memory allocation instead
of the system
<code class="literal">
malloc()
</code>
library. The
option value must be one of the directories
<code class="filename">
/usr/lib
</code>
,
<code class="filename">
/usr/lib64
</code>
,
<code class="filename">
/usr/lib/i386-linux-gnu
</code>
, or
<code class="filename">
/usr/lib/x86_64-linux-gnu
</code>
.
</p>
<p>
The
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib
</code>
</a>
option
works by modifying the
<code class="literal">
LD_PRELOAD
</code>
environment value to affect dynamic linking to enable the
loader to find the memory-allocation library when
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
runs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the option is not given, or is given without a value
(
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib=
</code>
</a>
),
<code class="literal">
LD_PRELOAD
</code>
is not modified and no
attempt is made to use
<code class="literal">
tcmalloc
</code>
.
</p>
</li>
<li class="listitem">
<p>
Prior to MySQL 8.0.21, if the option is given as
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib=tcmalloc
</code>
</a>
,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
looks for a
<code class="literal">
tcmalloc
</code>
library in
<code class="filename">
/usr/lib
</code>
. If
<code class="literal">
tmalloc
</code>
is found, its path name is
added to the beginning of the
<code class="literal">
LD_PRELOAD
</code>
value for
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. If
<code class="literal">
tcmalloc
</code>
is not found,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
aborts with an error.
</p>
<p>
As of MySQL 8.0.21,
<code class="literal">
tcmalloc
</code>
is not a
permitted value for the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
If the option is given as
<a class="link" href="mysqld-safe.html#option_mysqld_safe_malloc-lib">
<code class="option">
--malloc-lib=
<em class="replaceable">
<code>
/path/to/some/library
</code>
</em>
</code>
</a>
,
that full path is added to the beginning of the
<code class="literal">
LD_PRELOAD
</code>
value. If the full path
points to a nonexistent or unreadable file,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
aborts with an error.
</p>
</li>
<li class="listitem">
<p>
For cases where
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
adds a
path name to
<code class="literal">
LD_PRELOAD
</code>
, it adds the
path to the beginning of any existing value the variable
already has.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
On systems that manage the server using systemd,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
is not available. Instead,
specify the allocation library by setting
<code class="literal">
LD_PRELOAD
</code>
in
<code class="filename">
/etc/sysconfig/mysql
</code>
.
</p>
</div>
<p>
Linux users can use the
<code class="filename">
libtcmalloc_minimal.so
</code>
library on any
platform for which a
<code class="literal">
tcmalloc
</code>
package is
installed in
<code class="filename">
/usr/lib
</code>
by adding these
lines to the
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa98319342"><div class="copy-help left">Press ⌘+C to 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_safe]</span>
<span class="token constant">malloc-lib</span><span class="token attr-value"><span class="token punctuation">=</span>tcmalloc</span></code></pre>
</div>
<p>
To use a specific
<code class="literal">
tcmalloc
</code>
library,
specify its full path name. Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95479042"><div class="copy-help left">Press ⌘+C to 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_safe]</span>
<span class="token constant">malloc-lib</span><span class="token attr-value"><span class="token punctuation">=</span>/opt/lib/libtcmalloc_minimal.so</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_mysqld">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld">
<code class="option">
--mysqld=
<em class="replaceable">
<code>
prog_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for mysqld">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--mysqld=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321685504">
</a>
<a class="indexterm" name="idm46045321684112">
</a>
<p>
The name of the server program (in the
<code class="literal">
ledir
</code>
directory) that you want to start.
This option is needed if you use the MySQL binary
distribution but have the data directory outside of the
binary distribution. If
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
cannot find the server, use the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_ledir">
<code class="option">
--ledir
</code>
</a>
option to
indicate the path name to the directory where the server is
located.
</p>
<p>
This option is accepted only on the command line, not in
option files. On platforms that use systemd, the value can
be specified in the value of
<code class="literal">
MYSQLD_OPTS
</code>
.
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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_mysqld-version">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-version">
<code class="option">
--mysqld-version=
<em class="replaceable">
<code>
suffix
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for mysqld-version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--mysqld-version=suffix
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321668448">
</a>
<a class="indexterm" name="idm46045321667056">
</a>
<p>
This option is similar to the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld">
<code class="option">
--mysqld
</code>
</a>
option, but you
specify only the suffix for the server program name. The
base name is assumed to be
<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 use
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-version">
<code class="option">
--mysqld-version=debug
</code>
</a>
,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
starts the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld-debug
</strong>
</span>
</a>
program in the
<code class="literal">
ledir
</code>
directory. If the argument to
<a class="link" href="mysqld-safe.html#option_mysqld_safe_mysqld-version">
<code class="option">
--mysqld-version
</code>
</a>
is
empty,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
uses
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
in the
<code class="literal">
ledir
</code>
directory.
</p>
<p>
This option is accepted only on the command line, not in
option files. On platforms that use systemd, the value can
be specified in the value of
<code class="literal">
MYSQLD_OPTS
</code>
.
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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_nice">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_nice">
<code class="option">
--nice=
<em class="replaceable">
<code>
priority
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for nice">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--nice=priority
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321645664">
</a>
<a class="indexterm" name="idm46045321644272">
</a>
<p>
Use the
<code class="literal">
nice
</code>
program to set the server's
scheduling priority to the given value.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_no-defaults">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_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>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321632704">
</a>
<a class="indexterm" name="idm46045321631312">
</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="mysqld-safe.html#option_mysqld_safe_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
can be
used to prevent them from being read. This must be the first
option on the command line if it is used.
</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_mysqld_safe_open-files-limit">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_open-files-limit">
<code class="option">
--open-files-limit=
<em class="replaceable">
<code>
count
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for open-files-limit">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--open-files-limit=count
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321617568">
</a>
<a class="indexterm" name="idm46045321616080">
</a>
<p>
The number of files that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
should be
able to open. The option value is passed to
<span class="command">
<strong>
ulimit
-n
</strong>
</span>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You must start
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
as
<code class="literal">
root
</code>
for this to function properly.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_pid-file">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_pid-file">
<code class="option">
--pid-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for pid-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--pid-file=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321599408">
</a>
<a class="indexterm" name="idm46045321597920">
</a>
<p>
The path name that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
should use for
its process ID file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_plugin-dir">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_plugin-dir">
<code class="option">
--plugin-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for plugin-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--plugin-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321584720">
</a>
<a class="indexterm" name="idm46045321583232">
</a>
<p>
The path name of the plugin directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_port">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for port">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--port=number
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321571312">
</a>
<a class="indexterm" name="idm46045321569824">
</a>
<a class="indexterm" name="idm46045321568336">
</a>
<p>
The port number that the server should use when listening
for TCP/IP connections. The port number must be 1024 or
higher unless the server is started by the
<code class="literal">
root
</code>
operating system user.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_skip-kill-mysqld">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_skip-kill-mysqld">
<code class="option">
--skip-kill-mysqld
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-kill-mysqld">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-kill-mysqld
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321558272">
</a>
<a class="indexterm" name="idm46045321556784">
</a>
<p>
Do not try to kill stray
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
processes
at startup. This option works only on Linux.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_socket">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_socket">
<code class="option">
--socket=
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for socket">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--socket=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321543488">
</a>
<a class="indexterm" name="idm46045321542000">
</a>
<p>
The Unix socket file that the server should use when
listening for local connections.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_syslog">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--syslog
</code>
</a>
,
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--skip-syslog
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for syslog">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--syslog
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321529280">
</a>
<a class="indexterm" name="idm46045321527792">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-syslog">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-syslog
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321518816">
</a>
<a class="indexterm" name="idm46045321517328">
</a>
<p>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--syslog
</code>
</a>
causes error
messages to be sent to
<code class="literal">
syslog
</code>
on systems
that support the
<span class="command">
<strong>
logger
</strong>
</span>
program.
<code class="literal">
--skip-syslog
</code>
suppresses the use of
<code class="literal">
syslog
</code>
; messages are written to an error
log file.
</p>
<p>
When
<code class="literal">
syslog
</code>
is used for error logging,
the
<code class="literal">
daemon.err
</code>
facility/severity is used
for all log messages.
</p>
<p>
Using these options to control
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
logging is deprecated. To write error log output to the
system log, use the instructions at
<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>
. To control the facility,
use the server
<a class="ulink" href="/doc/refman/8.0/en/server-system-variables.html#sysvar_log_syslog_facility" target="_top">
<code class="literal">
log_syslog_facility
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_syslog-tag">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog-tag">
<code class="option">
--syslog-tag=
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for syslog-tag">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--syslog-tag=tag
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321495856">
</a>
<a class="indexterm" name="idm46045321494368">
</a>
<p>
For logging to
<code class="literal">
syslog
</code>
, messages from
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
and
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
are written with identifiers of
<code class="literal">
mysqld_safe
</code>
and
<code class="literal">
mysqld
</code>
, respectively. To specify a suffix
for the identifiers, use
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog-tag">
<code class="option">
--syslog-tag=
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
</a>
,
which modifies the identifiers to be
<code class="literal">
mysqld_safe-
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
and
<code class="literal">
mysqld-
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
.
</p>
<p>
Using this option to control
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
logging is deprecated. Use the server
<a class="ulink" href="/doc/refman/8.0/en/server-system-variables.html#sysvar_log_syslog_tag" target="_top">
<code class="literal">
log_syslog_tag
</code>
</a>
system
variable instead. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_timezone">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_timezone">
<code class="option">
--timezone=
<em class="replaceable">
<code>
timezone
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for timezone">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--timezone=timezone
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321470784">
</a>
<a class="indexterm" name="idm46045321469296">
</a>
<p>
Set the
<code class="literal">
TZ
</code>
time zone environment variable
to the given option value. Consult your operating system
documentation for legal time zone specification formats.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqld_safe_user">
</a>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_user">
<code class="option">
--user={
<em class="replaceable">
<code>
user_name
</code>
</em>
|
<em class="replaceable">
<code>
user_id
</code>
</em>
}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for user">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--user={user_name|user_id}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045321454016">
</a>
<a class="indexterm" name="idm46045321452528">
</a>
<p>
Run the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server as the user having
the name
<em class="replaceable">
<code>
user_name
</code>
</em>
or the numeric
user ID
<em class="replaceable">
<code>
user_id
</code>
</em>
.
(
<span class="quote">
“
<span class="quote">
User
</span>
”
</span>
in this context refers to a system
login account, not a MySQL user listed in the grant tables.)
</p>
</li>
</ul>
</div>
<p>
If you execute
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
with the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
or
<a class="link" href="mysqld-safe.html#option_mysqld_safe_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
option
to name an option file, the option must be the first one given
on the command line or the option file is not used. For example,
this command does not use the named option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa55031449"><div class="copy-help left">Press ⌘+C to 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"> mysqld_safe</span> <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">port_num</em></span> <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em></span></code></pre>
</div>
<p>
Instead, use the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa58537709"><div class="copy-help left">Press ⌘+C to 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"> mysqld_safe</span> <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em></span> <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">port_num</em></span></code></pre>
</div>
<p>
The
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
script is written so that it
normally can start a server that was installed from either a
source or a binary distribution of MySQL, even though these
types of distributions typically install the server in slightly
different locations. (See
<a class="xref" href="installation-layouts.html" title="2.1.5 Installation Layouts">
Section 2.1.5, “Installation Layouts”
</a>
.)
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
expects one of the following
conditions to be true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The server and databases can be found relative to the
working directory (the directory from which
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
is invoked). For binary
distributions,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
looks under
its working directory for
<code class="filename">
bin
</code>
and
<code class="filename">
data
</code>
directories. For source
distributions, it looks for
<code class="filename">
libexec
</code>
and
<code class="filename">
var
</code>
directories. This condition should
be met if you execute
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
from
your MySQL installation directory (for example,
<code class="filename">
/usr/local/mysql
</code>
for a binary
distribution).
</p>
</li>
<li class="listitem">
<p>
If the server and databases cannot be found relative to the
working directory,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
attempts
to locate them by absolute path names. Typical locations are
<code class="filename">
/usr/local/libexec
</code>
and
<code class="filename">
/usr/local/var
</code>
. The actual locations
are determined from the values configured into the
distribution at the time it was built. They should be
correct if MySQL is installed in the location specified at
configuration time.
</p>
</li>
</ul>
</div>
<p>
Because
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
tries to find the server
and databases relative to its own working directory, you can
install a binary distribution of MySQL anywhere, as long as you
run
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
from the MySQL installation
directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa78890608"><div class="copy-help left">Press ⌘+C to 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 <em class="replaceable">mysql_installation_directory</em>
bin/mysqld_safe &</code></pre>
</div>
<p>
If
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
fails, even when invoked from
the MySQL installation directory, specify the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_ledir">
<code class="option">
--ledir
</code>
</a>
and
<a class="link" href="mysqld-safe.html#option_mysqld_safe_datadir">
<code class="option">
--datadir
</code>
</a>
options to
indicate the directories in which the server and databases are
located on your system.
</p>
<p>
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
tries to use the
<span class="command">
<strong>
sleep
</strong>
</span>
and
<span class="command">
<strong>
date
</strong>
</span>
system
utilities to determine how many times per second it has
attempted to start. If these utilities are present and the
attempted starts per second is greater than 5,
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
waits 1 full second before
starting again. This is intended to prevent excessive CPU usage
in the event of repeated failures. (Bug #11761530, Bug #54035)
</p>
<p>
When you use
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
to start
<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="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
arranges for error (and notice) messages from itself and from
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
to go to the same destination.
</p>
<p>
There are several
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
options for
controlling the destination of these messages:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
:
Write error messages to the named error file.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--syslog
</code>
</a>
: Write error
messages to
<code class="literal">
syslog
</code>
on systems that
support the
<span class="command">
<strong>
logger
</strong>
</span>
program.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--skip-syslog
</code>
</a>
:
Do not write error messages to
<code class="literal">
syslog
</code>
.
Messages are written to the default error log file
(
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
in the data directory), or to a named file if the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error
</code>
</a>
option is
given.
</p>
</li>
</ul>
</div>
<p>
If none of these options is given, the default is
<a class="link" href="mysqld-safe.html#option_mysqld_safe_syslog">
<code class="option">
--skip-syslog
</code>
</a>
.
</p>
<p>
When
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
writes a message, notices go
to the logging destination (
<code class="literal">
syslog
</code>
or the
error log file) and
<code class="literal">
stdout
</code>
. Errors go to the
logging destination and
<code class="literal">
stderr
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Controlling
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
logging from
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
is deprecated. Use the server's
native
<code class="literal">
syslog
</code>
support instead. For more
information, see
<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>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-statements-with-temp-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-statements-with-temp-tables">
</a>
30.4.3.40 The statements_with_temp_tables and x$statements_with_temp_tables Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062012784">
</a>
<a class="indexterm" name="idm46045062011328">
</a>
<a class="indexterm" name="idm46045062009824">
</a>
<a class="indexterm" name="idm46045062008320">
</a>
<p>
These views list normalized statements that have used
temporary tables. By default, rows are sorted by descending
number of on-disk temporary tables used and descending number
of in-memory temporary tables used.
</p>
<p>
The
<a class="link" href="sys-statements-with-temp-tables.html" title="30.4.3.40 The statements_with_temp_tables and x$statements_with_temp_tables Views">
<code class="literal">
statements_with_temp_tables
</code>
</a>
and
<a class="link" href="sys-statements-with-temp-tables.html" title="30.4.3.40 The statements_with_temp_tables and x$statements_with_temp_tables Views">
<code class="literal">
x$statements_with_temp_tables
</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">
exec_count
</code>
</p>
<p>
The total number of times the statement has executed.
</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">
memory_tmp_tables
</code>
</p>
<p>
The total number of internal in-memory temporary tables
created by occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
disk_tmp_tables
</code>
</p>
<p>
The total number of internal on-disk temporary tables
created by occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_tmp_tables_per_query
</code>
</p>
<p>
The average number of internal temporary tables created
per occurrence of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tmp_tables_to_disk_pct
</code>
</p>
<p>
The percentage of internal in-memory temporary tables that
were converted to on-disk tables.
</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/enterprise-encryption-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="enterprise-encryption-installation">
</a>
8.6.1 MySQL Enterprise Encryption Installation and Upgrading
</h3>
</div>
</div>
</div>
<p>
The functions are provided by a MySQL component
<code class="literal">
component_enterprise_encryption
</code>
, and installing
the component installs all of the functions.
</p>
<p>
MySQL Enterprise Encryption functions are provided by the MySQL
<code class="literal">
component_enterprise_encryption
</code>
component. For
upgrade information, see
<a class="ulink" href="/doc/refman/8.0/en/enterprise-encryption-installation.html#enterprise-encryption-upgrading" target="_top">
Upgrading MySQL Enterprise Encryption
</a>
.
</p>
<p>
If you are upgrading from a release prior to MySQL 8.0.30: Before
installing the component, unload any legacy functions using the
<a class="link" href="drop-function-loadable.html" title="15.7.4.2 DROP FUNCTION Statement for Loadable Functions">
<code class="literal">
DROP
FUNCTION
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69645394"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FUNCTION</span> asymmetric_decrypt<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> asymmetric_derive<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> asymmetric_encrypt<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> asymmetric_sign<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> asymmetric_verify<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> create_asymmetric_priv_key<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> create_asymmetric_pub_key<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> create_dh_parameters<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> create_digest<span class="token punctuation">;</span></code></pre>
</div>
<p>
The function names must be specified in lowercase. The statements
require the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege for the
<code class="literal">
mysql
</code>
database.
</p>
<p>
To install the component, issue this
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL
COMPONENT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa69544216"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_enterprise_encryption"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
<code class="literal">
INSTALL COMPONENT
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_insert">
<code class="literal">
INSERT
</code>
</a>
privilege for the
<code class="literal">
mysql.component
</code>
system table because it adds a
row to that table to register the component. To verify that the
component has been installed, issue the statement shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa38609271"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> mysql<span class="token punctuation">.</span><span class="token keyword">component</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Components listed in
<code class="literal">
mysql.component
</code>
are loaded
by the loader service during the startup sequence.
</p>
<p>
If you need to uninstall the component, issue an
<a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
<code class="literal">
UNINSTALL COMPONENT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa6090175"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COMPONENT</span> <span class="token string">"file://component_enterprise_encryption"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Uninstalling the component uninstalls all of the functions. For
more details, see
<a class="xref" href="component-loading.html" title="7.5.1 Installing and Uninstalling Components">
Section 7.5.1, “Installing and Uninstalling Components”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Installing the component installs all of its functions, so you
do not need to create them using
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE
FUNCTION
</code>
</a>
statements as in older releases of MySQL.
</p>
</div>
<p>
When you have installed the component, if you want the component
functions to support decryption and verification for content
produced by legacy functions, set the
<a class="link" href="server-system-variables.html#sysvar_enterprise_encryption.rsa_support_legacy_padding">
<code class="literal">
enterprise_encryption.rsa_support_legacy_padding
</code>
</a>
system variable to
<code class="literal">
ON
</code>
. Also, if you want to
change the maximum length allowed for the RSA keys generated by
the component functions, use the
<a class="link" href="server-system-variables.html#sysvar_enterprise_encryption.maximum_rsa_key_size">
<code class="literal">
enterprise_encryption.maximum_rsa_key_size
</code>
</a>
system variable to set an appropriate maximum. For configuration
information, see
<a class="xref" href="enterprise-encryption-configuring.html" title="8.6.2 Configuring MySQL Enterprise Encryption">
Section 8.6.2, “Configuring MySQL Enterprise Encryption”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/roles.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="roles">
</a>
8.2.10 Using Roles
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045249426528">
</a>
<p>
A MySQL role is a named collection of privileges. Like user
accounts, roles can have privileges granted to and revoked from
them.
</p>
<p>
A user account can be granted roles, which grants to the account
the privileges associated with each role. This enables assignment
of sets of privileges to accounts and provides a convenient
alternative to granting individual privileges, both for
conceptualizing desired privilege assignments and implementing
them.
</p>
<p>
The following list summarizes role-management capabilities
provided by MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE ROLE
</code>
</a>
and
<a class="link" href="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
create and remove
roles.
</p>
</li>
<li class="listitem">
<p>
<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>
assign privileges to
revoke privileges from user accounts and roles.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
displays privilege
and role assignments for user accounts and roles.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
specifies
which account roles are active by default.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
</code>
</a>
changes the active
roles within the current session.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="information-functions.html#function_current-role">
<code class="literal">
CURRENT_ROLE()
</code>
</a>
function
displays the active roles within the current session.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_activate_all_roles_on_login">
<code class="literal">
activate_all_roles_on_login
</code>
</a>
system variables enable defining mandatory roles and automatic
activation of granted roles when users log in to the server.
</p>
</li>
</ul>
</div>
<p>
For descriptions of individual role-manipulation statements
(including the privileges required to use them), see
<a class="xref" href="account-management-statements.html" title="15.7.1 Account Management Statements">
Section 15.7.1, “Account Management Statements”
</a>
. The following
discussion provides examples of role usage. Unless otherwise
specified, SQL statements shown here should be executed using a
MySQL account with sufficient administrative privileges, such as
the
<code class="literal">
root
</code>
account.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="roles.html#roles-creating-granting" title="Creating Roles and Granting Privileges to Them">
Creating Roles and Granting Privileges to Them
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#mandatory-roles" title="Defining Mandatory Roles">
Defining Mandatory Roles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#roles-checking" title="Checking Role Privileges">
Checking Role Privileges
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#roles-activating" title="Activating Roles">
Activating Roles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#roles-revoking" title="Revoking Roles or Role Privileges">
Revoking Roles or Role Privileges
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#roles-dropping" title="Dropping Roles">
Dropping Roles
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="roles.html#role-user-interchangeability" title="User and Role Interchangeability">
User and Role Interchangeability
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="roles-creating-granting">
</a>
Creating Roles and Granting Privileges to Them
</h4>
</div>
</div>
</div>
<p>
Consider this scenario:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An application uses a database named
<code class="literal">
app_db
</code>
.
</p>
</li>
<li class="listitem">
<p>
Associated with the application, there can be accounts for
developers who create and maintain the application, and for
users who interact with it.
</p>
</li>
<li class="listitem">
<p>
Developers need full access to the database. Some users need
only read access, others need read/write access.
</p>
</li>
</ul>
</div>
<p>
To avoid granting privileges individually to possibly many user
accounts, create roles as names for the required privilege sets.
This makes it easy to grant the required privileges to user
accounts, by granting the appropriate roles.
</p>
<p>
To create the roles, use the
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE
ROLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa16215004"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ROLE</span> <span class="token string">'app_developer'</span><span class="token punctuation">,</span> <span class="token string">'app_read'</span><span class="token punctuation">,</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Role names are much like user account names and consist of a
user part and host part in
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
'@'
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
format. The host part, if omitted, defaults to
<code class="literal">
'%'
</code>
. The user and host parts can be unquoted
unless they contain special characters such as
<code class="literal">
-
</code>
or
<code class="literal">
%
</code>
. Unlike account
names, the user part of role names cannot be blank. For
additional information, see
<a class="xref" href="role-names.html" title="8.2.5 Specifying Role Names">
Section 8.2.5, “Specifying Role Names”
</a>
.
</p>
<p>
To assign privileges to the roles, execute
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements using the same
syntax as for assigning privileges to user accounts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17536569"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> app_db<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'app_developer'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> app_db<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'app_read'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">INSERT</span><span class="token punctuation">,</span> <span class="token keyword">UPDATE</span><span class="token punctuation">,</span> <span class="token keyword">DELETE</span> <span class="token keyword">ON</span> app_db<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now suppose that initially you require one developer account,
two user accounts that need read-only access, and one user
account that needs read/write access. Use
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
to create the
accounts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99590445"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">'dev1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'dev1pass'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'read_user1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'read_user1pass'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'read_user2'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'read_user2pass'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'rw_user1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'rw_user1pass'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To assign each user account its required privileges, you could
use
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements of the same
form as just shown, but that requires enumerating individual
privileges for each user. Instead, use an alternative
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
syntax that permits
granting roles rather than privileges:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93950643"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANT</span> <span class="token string">'app_developer'</span> <span class="token keyword">TO</span> <span class="token string">'dev1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token string">'app_read'</span> <span class="token keyword">TO</span> <span class="token string">'read_user1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span> <span class="token string">'read_user2'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token string">'app_read'</span><span class="token punctuation">,</span> <span class="token string">'app_write'</span> <span class="token keyword">TO</span> <span class="token string">'rw_user1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statement for the
<code class="literal">
rw_user1
</code>
account grants the read and write
roles, which combine to provide the required read and write
privileges.
</p>
<p>
The
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
syntax for granting
roles to an account differs from the syntax for granting
privileges: There is an
<code class="literal">
ON
</code>
clause to assign
privileges, whereas there is no
<code class="literal">
ON
</code>
clause to
assign roles. Because the syntaxes are distinct, you cannot mix
assigning privileges and roles in the same statement. (It is
permitted to assign both privileges and roles to an account, but
you must use separate
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements, each with syntax appropriate to what is to be
granted.) Roles cannot be granted to anonymous users.
</p>
<p>
A role when created is locked, has no password, and is assigned
the default authentication plugin. (These role attributes can be
changed later with the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement, by users who have the global
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege.)
</p>
<p>
While locked, a role cannot be used to authenticate to the
server. If unlocked, a role can be used to authenticate. This is
because roles and users are both authorization identifiers with
much in common and little to distinguish them. See also
<a class="xref" href="roles.html#role-user-interchangeability" title="User and Role Interchangeability">
User and Role Interchangeability
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="mandatory-roles">
</a>
Defining Mandatory Roles
</h4>
</div>
</div>
</div>
<p>
It is possible to specify roles as mandatory by naming them in
the value of the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system
variable. The server treats a mandatory role as granted to all
users, so that it need not be granted explicitly to any account.
</p>
<p>
To specify mandatory roles at server startup, define
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
in your server
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa57998009"><div class="copy-help left">Press ⌘+C to 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">mandatory_roles</span><span class="token attr-value"><span class="token punctuation">=</span>'role1,role2@localhost,r3@%.example.com'</span></code></pre>
</div>
<p>
To set and persist
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
at runtime, use
a statement like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61061251"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> mandatory_roles <span class="token operator">=</span> <span class="token string">'role1,role2@localhost,r3@%.example.com'</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 the 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>
<p>
Setting
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_role-admin">
<code class="literal">
ROLE_ADMIN
</code>
</a>
privilege, in addition to the
<a class="link" href="privileges-provided.html#priv_system-variables-admin">
<code class="literal">
SYSTEM_VARIABLES_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege) normally required to set a global system variable.
</p>
<p>
Mandatory roles, like explicitly granted roles, do not take
effect until activated (see
<a class="xref" href="roles.html#roles-activating" title="Activating Roles">
Activating Roles
</a>
).
At login time, role activation occurs for all granted roles if
the
<a class="link" href="server-system-variables.html#sysvar_activate_all_roles_on_login">
<code class="literal">
activate_all_roles_on_login
</code>
</a>
system variable is enabled, or for roles that are set as default
roles otherwise. At runtime,
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET
ROLE
</code>
</a>
activates roles.
</p>
<p>
Roles named in the value of
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
cannot be
revoked with
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
or dropped
with
<a class="link" href="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
or
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
.
</p>
<p>
To prevent sessions from being made system sessions by default,
a role that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege cannot be listed in the value of the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system
variable:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
is
assigned a role at startup that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, the
server writes a message to the error log and exits.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
is
assigned a role at runtime that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, an
error occurs and the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
value
remains unchanged.
</p>
</li>
</ul>
</div>
<p>
Even with this safeguard, it is better to avoid granting the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege through a
role in order to guard against the possibility of privilege
escalation.
</p>
<p>
If a role named in
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
is not present
in the
<code class="literal">
mysql.user
</code>
system table, the role is
not granted to users. When the server attempts role activation
for a user, it does not treat the nonexistent role as mandatory
and writes a warning to the error log. If the role is created
later and thus becomes valid,
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
may be necessary to cause the server to
treat it as mandatory.
</p>
<p>
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
displays mandatory
roles according to the rules described in
<a class="xref" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
Section 15.7.7.22, “SHOW GRANTS Statement”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="roles-checking">
</a>
Checking Role Privileges
</h4>
</div>
</div>
</div>
<p>
To verify the privileges assigned to an account, use
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51493330"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'dev1'</span>@<span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> Grants for dev1@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `dev1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `app_developer`@`%` TO `dev1`@`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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
However, that shows each granted role without
<span class="quote">
“
<span class="quote">
expanding
</span>
”
</span>
it to the privileges the role
represents. To show role privileges as well, add a
<code class="literal">
USING
</code>
clause naming the granted roles for
which to display privileges:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25382679"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'dev1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">USING</span> <span class="token string">'app_developer'</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>
<span class="token output"><span class="token punctuation">|</span> Grants for dev1@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `dev1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT ALL PRIVILEGES ON `app_db`.* TO `dev1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `app_developer`@`%` TO `dev1`@`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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Verify each other type of user similarly:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95738986"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'read_user1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">USING</span> <span class="token string">'app_read'</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>
<span class="token output"><span class="token punctuation">|</span> Grants for read_user1@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `read_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `app_db`.* TO `read_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `app_read`@`%` TO `read_user1`@`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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">SHOW</span> <span class="token keyword">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'rw_user1'</span>@<span class="token string">'localhost'</span> <span class="token keyword">USING</span> <span class="token string">'app_read'</span><span class="token punctuation">,</span> <span class="token string">'app_write'</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>
<span class="token output"><span class="token punctuation">|</span> Grants for rw_user1@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `rw_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT, INSERT, UPDATE, DELETE ON `app_db`.* TO `rw_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `app_read`@`%`,`app_write`@`%` TO `rw_user1`@`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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
displays mandatory
roles according to the rules described in
<a class="xref" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
Section 15.7.7.22, “SHOW GRANTS Statement”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="roles-activating">
</a>
Activating Roles
</h4>
</div>
</div>
</div>
<p>
Roles granted to a user account can be active or inactive within
account sessions. If a granted role is active within a session,
its privileges apply; otherwise, they do not. To determine which
roles are active within the current session, use the
<a class="link" href="information-functions.html#function_current-role">
<code class="literal">
CURRENT_ROLE()
</code>
</a>
function.
</p>
<p>
By default, granting a role to an account or naming it in the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system variable
value does not automatically cause the role to become active
within account sessions. For example, because thus far in the
preceding discussion no
<code class="literal">
rw_user1
</code>
roles have
been activated, if you connect to the server as
<code class="literal">
rw_user1
</code>
and invoke the
<a class="link" href="information-functions.html#function_current-role">
<code class="literal">
CURRENT_ROLE()
</code>
</a>
function, the
result is
<code class="literal">
NONE
</code>
(no active roles):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42023574"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CURRENT_ROLE</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_ROLE() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NONE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 specify which roles should become active each time a user
connects to the server and authenticates, use
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
. To set the
default to all assigned roles for each account created earlier,
use this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28944682"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DEFAULT</span> <span class="token keyword">ROLE</span> <span class="token keyword">ALL</span> <span class="token keyword">TO</span>
<span class="token string">'dev1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span>
<span class="token string">'read_user1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span>
<span class="token string">'read_user2'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span>
<span class="token string">'rw_user1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now if you connect as
<code class="literal">
rw_user1
</code>
, the initial
value of
<a class="link" href="information-functions.html#function_current-role">
<code class="literal">
CURRENT_ROLE()
</code>
</a>
reflects
the new default role assignments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79168772"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CURRENT_ROLE</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_ROLE() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `app_read`@`%`,`app_write`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 cause all explicitly granted and mandatory roles to be
automatically activated when users connect to the server, enable
the
<a class="link" href="server-system-variables.html#sysvar_activate_all_roles_on_login">
<code class="literal">
activate_all_roles_on_login
</code>
</a>
system variable. By default, automatic role activation is
disabled.
</p>
<p>
Within a session, a user can execute
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET
ROLE
</code>
</a>
to change the set of active roles. For example,
for
<code class="literal">
rw_user1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75442055"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ROLE</span> <span class="token keyword">NONE</span><span class="token punctuation">;</span> <span class="token keyword">SELECT</span> <span class="token function">CURRENT_ROLE</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_ROLE() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NONE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">ROLE</span> <span class="token keyword">ALL</span> <span class="token keyword">EXCEPT</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span> <span class="token keyword">SELECT</span> <span class="token function">CURRENT_ROLE</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_ROLE() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `app_read`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">ROLE</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">;</span> <span class="token keyword">SELECT</span> <span class="token function">CURRENT_ROLE</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_ROLE() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `app_read`@`%`,`app_write`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 first
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
</code>
</a>
statement
deactivates all roles. The second makes
<code class="literal">
rw_user1
</code>
effectively read only. The third
restores the default roles.
</p>
<a class="indexterm" name="idm46045249268832">
</a>
<a class="indexterm" name="idm46045249267344">
</a>
<a class="indexterm" name="idm46045249265856">
</a>
<a class="indexterm" name="idm46045249264368">
</a>
<p>
The effective user for stored program and view objects is
subject to the
<code class="literal">
DEFINER
</code>
and
<code class="literal">
SQL
SECURITY
</code>
attributes, which determine whether execution
occurs in invoker or definer context (see
<a class="xref" href="stored-objects-security.html" title="27.6 Stored Object Access Control">
Section 27.6, “Stored Object Access Control”
</a>
):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Stored program and view objects that execute in invoker
context execute with the roles that are active within the
current session.
</p>
</li>
<li class="listitem">
<p>
Stored program and view objects that execute in definer
context execute with the default roles of the user named in
their
<code class="literal">
DEFINER
</code>
attribute. If
<a class="link" href="server-system-variables.html#sysvar_activate_all_roles_on_login">
<code class="literal">
activate_all_roles_on_login
</code>
</a>
is enabled, such objects execute with all roles granted to
the
<code class="literal">
DEFINER
</code>
user, including mandatory
roles. For stored programs, if execution should occur with
roles different from the default, the program body can
execute
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET
ROLE
</code>
</a>
to activate the required roles. This must be
done with caution since the privileges assigned to roles can
be changed.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="roles-revoking">
</a>
Revoking Roles or Role Privileges
</h4>
</div>
</div>
</div>
<p>
Just as roles can be granted to an account, they can be revoked
from an account:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67363461"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">REVOKE</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token keyword">FROM</span> <span class="token keyword"><em class="replaceable">user</em></span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Roles named in the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system variable
value cannot be revoked.
</p>
<p>
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
can also be applied to a
role to modify the privileges granted to it. This affects not
only the role itself, but any account granted that role. Suppose
that you want to temporarily make all application users read
only. To do this, use
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
to
revoke the modification privileges from the
<code class="literal">
app_write
</code>
role:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa71483718"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">REVOKE</span> <span class="token keyword">INSERT</span><span class="token punctuation">,</span> <span class="token keyword">UPDATE</span><span class="token punctuation">,</span> <span class="token keyword">DELETE</span> <span class="token keyword">ON</span> app_db<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
As it happens, that leaves the role with no privileges at all,
as can be seen using
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
(which demonstrates that this statement can be used with roles,
not just users):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17757335"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'app_write'</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> Grants for app_write@% <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `app_write`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Because revoking privileges from a role affects the privileges
for any user who is assigned the modified role,
<code class="literal">
rw_user1
</code>
now has no table modification
privileges (
<a class="link" href="privileges-provided.html#priv_insert">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
, and
<a class="link" href="privileges-provided.html#priv_delete">
<code class="literal">
DELETE
</code>
</a>
are no longer present):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87858159"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'rw_user1'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">USING</span> <span class="token string">'app_read'</span><span class="token punctuation">,</span> <span class="token string">'app_write'</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>
<span class="token output"><span class="token punctuation">|</span> Grants for rw_user1@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `rw_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `app_db`.* TO `rw_user1`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `app_read`@`%`,`app_write`@`%` TO `rw_user1`@`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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 effect, the
<code class="literal">
rw_user1
</code>
read/write user has
become a read-only user. This also occurs for any other accounts
that are granted the
<code class="literal">
app_write
</code>
role,
illustrating how use of roles makes it unnecessary to modify
privileges for individual accounts.
</p>
<p>
To restore modification privileges to the role, simply re-grant
them:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12527907"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANT</span> <span class="token keyword">INSERT</span><span class="token punctuation">,</span> <span class="token keyword">UPDATE</span><span class="token punctuation">,</span> <span class="token keyword">DELETE</span> <span class="token keyword">ON</span> app_db<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now
<code class="literal">
rw_user1
</code>
again has modification
privileges, as do any other accounts granted the
<code class="literal">
app_write
</code>
role.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="roles-dropping">
</a>
Dropping Roles
</h4>
</div>
</div>
</div>
<p>
To drop roles, use
<a class="link" href="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa41275390"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ROLE</span> <span class="token string">'app_read'</span><span class="token punctuation">,</span> <span class="token string">'app_write'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Dropping a role revokes it from every account to which it was
granted.
</p>
<p>
Roles named in the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system variable
value cannot be dropped.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="role-user-interchangeability">
</a>
User and Role Interchangeability
</h4>
</div>
</div>
</div>
<p>
As has been hinted at earlier for
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW
GRANTS
</code>
</a>
, which displays grants for user accounts or
roles, accounts and roles can be used interchangeably.
</p>
<p>
One difference between roles and users is that
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE ROLE
</code>
</a>
creates an
authorization identifier that is locked by default, whereas
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
creates an
authorization identifier that is unlocked by default. You should
keep in mind that this distinction is not immutable; a user with
appropriate privileges can lock or unlock roles or (other) users
after they have been created.
</p>
<p>
If a database administrator has a preference that a specific
authorization identifier must be a role, a name scheme can be
used to communicate this intention. For example, you could use a
<code class="literal">
r_
</code>
prefix for all authorization identifiers
that you intend to be roles and nothing else.
</p>
<p>
Another difference between roles and users lies in the
privileges available for administering them:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_create-role">
<code class="literal">
CREATE ROLE
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_drop-role">
<code class="literal">
DROP ROLE
</code>
</a>
privileges enable
only use of the
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE ROLE
</code>
</a>
and
<a class="link" href="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
statements,
respectively.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege
enables use of the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
,
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE ROLE
</code>
</a>
,
<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="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
,
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
,
<a class="link" href="rename-user.html" title="15.7.1.7 RENAME USER Statement">
<code class="literal">
RENAME USER
</code>
</a>
, and
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE ALL
PRIVILEGES
</code>
</a>
statements.
</p>
</li>
</ul>
</div>
<p>
Thus, the
<a class="link" href="privileges-provided.html#priv_create-role">
<code class="literal">
CREATE ROLE
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_drop-role">
<code class="literal">
DROP ROLE
</code>
</a>
privileges are not as
powerful as
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
and may
be granted to users who should only be permitted to create and
drop roles, and not perform more general account manipulation.
</p>
<p>
With regard to privileges and interchangeability of users and
roles, you can treat a user account like a role and grant that
account to another user or a role. The effect is to grant the
account's privileges and roles to the other user or role.
</p>
<p>
This set of statements demonstrates that you can grant a user to
a user, a role to a user, a user to a role, or a role to a role:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60766683"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">'u1'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">ROLE</span> <span class="token string">'r1'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> db1<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'u1'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> db2<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'r1'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'u2'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">ROLE</span> <span class="token string">'r2'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token string">'u1'</span><span class="token punctuation">,</span> <span class="token string">'r1'</span> <span class="token keyword">TO</span> <span class="token string">'u2'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token string">'u1'</span><span class="token punctuation">,</span> <span class="token string">'r1'</span> <span class="token keyword">TO</span> <span class="token string">'r2'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The result in each case is to grant to the grantee object the
privileges associated with the granted object. After executing
those statements, each of
<code class="literal">
u2
</code>
and
<code class="literal">
r2
</code>
have been granted privileges from a user
(
<code class="literal">
u1
</code>
) and a role (
<code class="literal">
r1
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59390324"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'u2'</span> <span class="token keyword">USING</span> <span class="token string">'u1'</span><span class="token punctuation">,</span> <span class="token string">'r1'</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> Grants for u2@% <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `u2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `db1`.* TO `u2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `db2`.* TO `u2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `u1`@`%`,`r1`@`%` TO `u2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">SHOW</span> <span class="token keyword">GRANTS</span> <span class="token keyword">FOR</span> <span class="token string">'r2'</span> <span class="token keyword">USING</span> <span class="token string">'u1'</span><span class="token punctuation">,</span> <span class="token string">'r1'</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> Grants for r2@% <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `r2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `db1`.* TO `r2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT SELECT ON `db2`.* TO `r2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT `u1`@`%`,`r1`@`%` TO `r2`@`%` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 is illustrative only, but
interchangeability of user accounts and roles has practical
application, such as in the following situation: Suppose that a
legacy application development project began before the advent
of roles in MySQL, so all user accounts associated with the
project are granted privileges directly (rather than granted
privileges by virtue of being granted roles). One of these
accounts is a developer account that was originally granted
privileges as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63877322"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">'old_app_dev'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'old_app_devpass'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> old_app<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> <span class="token string">'old_app_dev'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If this developer leaves the project, it becomes necessary to
assign the privileges to another user, or perhaps multiple users
if development activities have expanded. Here are some ways to
deal with the issue:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Without using roles: Change the account password so the
original developer cannot use it, and have a new developer
use the account instead:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa46344697"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'old_app_dev'</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">new_password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Using roles: Lock the account to prevent anyone from using
it to connect to the server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37582073"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'old_app_dev'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ACCOUNT</span> <span class="token keyword">LOCK</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Then treat the account as a role. For each developer new to
the project, create a new account and grant to it the
original developer account:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25140826"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">'new_app_dev1'</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">new_password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token string">'old_app_dev'</span>@<span class="token string">'localhost'</span> <span class="token keyword">TO</span> <span class="token string">'new_app_dev1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The effect is to assign the original developer account
privileges to the new account.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/server-plugins.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="server-plugins">
</a>
7.6 MySQL Server Plugins
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="plugin-loading.html">
7.6.1 Installing and Uninstalling Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="obtaining-plugin-information.html">
7.6.2 Obtaining Server Plugin Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="thread-pool.html">
7.6.3 MySQL Enterprise Thread Pool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="rewriter-query-rewrite-plugin.html">
7.6.4 The Rewriter Query Rewrite Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ddl-rewriter.html">
7.6.5 The ddl_rewriter Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="version-tokens.html">
7.6.6 Version Tokens
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="clone-plugin.html">
7.6.7 The Clone Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="daemon-keyring-proxy-plugin.html">
7.6.8 The Keyring Proxy Bridge Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="plugin-services.html">
7.6.9 MySQL Plugin Services
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045257133472">
</a>
<a class="indexterm" name="idm46045257132400">
</a>
<a class="indexterm" name="idm46045257131328">
</a>
<p>
MySQL supports an plugin API that enables creation of server
plugins. Plugins can be loaded at server startup, or loaded and
unloaded at runtime without restarting the server. The plugins
supported by this interface include, but are not limited to, storage
engines,
<code class="literal">
INFORMATION_SCHEMA
</code>
tables, full-text
parser plugins, and server extensions.
</p>
<p>
MySQL distributions include several plugins that implement server
extensions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Plugins for authenticating attempts by clients to connect to
MySQL Server. Plugins are available for several authentication
protocols. See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
A connection-control plugin that enables administrators to
introduce an increasing delay after a certain number of
consecutive failed client connection attempts. See
<a class="xref" href="connection-control.html" title="8.4.2 The Connection-Control Plugins">
Section 8.4.2, “The Connection-Control Plugins”
</a>
.
</p>
</li>
<li class="listitem">
<p>
A password-validation plugin implements password strength
policies and assesses the strength of potential passwords. See
<a class="xref" href="validate-password.html" title="8.4.3 The Password Validation Component">
Section 8.4.3, “The Password Validation Component”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Semisynchronous replication plugins implement an interface to
replication capabilities that permit the source to proceed as
long as at least one replica has responded to each transaction.
See
<a class="xref" href="replication-semisync.html" title="19.4.10 Semisynchronous Replication">
Section 19.4.10, “Semisynchronous Replication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Group Replication enables you to create a highly available
distributed MySQL service across a group of MySQL server
instances, with data consistency, conflict detection and
resolution, and group membership services all built-in. See
<a class="xref" href="group-replication.html" title="Chapter 20 Group Replication">
Chapter 20,
<i>
Group Replication
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes a thread pool plugin that manages connection
threads to increase server performance by efficiently managing
statement execution threads for large numbers of client
connections. 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>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes an audit plugin for monitoring and logging of
connection and query activity. See
<a class="xref" href="audit-log.html" title="8.4.5 MySQL Enterprise Audit">
Section 8.4.5, “MySQL Enterprise Audit”
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition includes a firewall plugin that implements an
application-level firewall to enable database administrators to
permit or deny SQL statement execution based on matching against
allowlists of accepted statement patterns. See
<a class="xref" href="firewall.html" title="8.4.7 MySQL Enterprise Firewall">
Section 8.4.7, “MySQL Enterprise Firewall”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Query rewrite plugins examine statements received by MySQL
Server and possibly rewrite them before the server executes
them. See
<a class="xref" href="rewriter-query-rewrite-plugin.html" title="7.6.4 The Rewriter Query Rewrite Plugin">
Section 7.6.4, “The Rewriter Query Rewrite Plugin”
</a>
, and
<a class="xref" href="ddl-rewriter.html" title="7.6.5 The ddl_rewriter Plugin">
Section 7.6.5, “The ddl_rewriter Plugin”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Version Tokens enables creation of and synchronization around
server tokens that applications can use to prevent accessing
incorrect or out-of-date data. Version Tokens is based on a
plugin library that implements a
<code class="literal">
version_tokens
</code>
plugin and a set of loadable
functions. See
<a class="xref" href="version-tokens.html" title="7.6.6 Version Tokens">
Section 7.6.6, “Version Tokens”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Keyring plugins provide secure storage for sensitive
information. See
<a class="xref" href="keyring.html" title="8.4.4 The MySQL Keyring">
Section 8.4.4, “The MySQL Keyring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
X Plugin extends MySQL Server to be able to function as a
document store. Running X Plugin enables MySQL Server to
communicate with clients using the X Protocol, which is
designed to expose the ACID compliant storage abilities of MySQL
as a document store. See
<a class="xref" href="x-plugin.html" title="22.5 X Plugin">
Section 22.5, “X Plugin”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Clone permits cloning
<code class="literal">
InnoDB
</code>
data from a
local or remote MySQL server instance. See
<a class="xref" href="clone-plugin.html" title="7.6.7 The Clone Plugin">
Section 7.6.7, “The Clone Plugin”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Test framework plugins test server services. For information
about these plugins, see the Plugins for Testing Plugin Services
section of the MySQL Server Doxygen documentation, available at
<a class="ulink" href="/doc/index-other.html" target="_top">
https://dev.mysql.com/doc/index-other.html
</a>
.
</p>
</li>
</ul>
</div>
<p>
The following sections describe how to install and uninstall
plugins, and how to determine at runtime which plugins are installed
and obtain information about them. For information about writing
plugins, see
<a class="ulink" href="/doc/extending-mysql/8.4/en/plugin-api.html" target="_top">
The MySQL Plugin API
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/password-logging.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="password-logging">
</a>
8.1.2.3 Passwords and Logging
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045252837232">
</a>
<a class="indexterm" name="idm46045252835744">
</a>
<p>
Passwords can be written as plain text in SQL 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="set-password.html" title="15.7.1.10 SET PASSWORD Statement">
<code class="literal">
SET PASSWORD
</code>
</a>
. If such statements
are logged by the MySQL server as written, passwords in them
become visible to anyone with access to the logs.
</p>
<p>
Statement logging avoids writing passwords as cleartext for the
following statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72115529"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">SET</span> <span class="token keyword">PASSWORD</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">START</span> <span class="token keyword">REPLICA</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">PASSWORD</span> <span class="token operator">=</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">CREATE</span> <span class="token keyword">SERVER</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">OPTIONS</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">PASSWORD</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">ALTER</span> <span class="token keyword">SERVER</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">OPTIONS</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">PASSWORD</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>
Passwords in those statements are rewritten to not appear
literally in statement text written to the general query log,
slow query log, and binary log. Rewriting does not apply to
other statements. In particular,
<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>
statements for the
<code class="literal">
mysql.user
</code>
system table that refer to literal
passwords are logged as is, so you should avoid such statements.
(Direct modification of grant tables is discouraged, anyway.)
</p>
<p>
For the general query log, password rewriting can be suppressed
by starting the server with the
<a class="link" href="server-options.html#option_mysqld_log-raw">
<code class="option">
--log-raw
</code>
</a>
option. For security
reasons, this option is not recommended for production use. For
diagnostic purposes, it may be useful to see the exact text of
statements as received by the server.
</p>
<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. See
<a class="xref" href="audit-log-security.html" title="8.4.5.3 MySQL Enterprise Audit Security Considerations">
Section 8.4.5.3, “MySQL Enterprise Audit Security Considerations”
</a>
.
</p>
<p>
Statements received by the server may be rewritten if a query
rewrite plugin is installed (see
<a class="ulink" href="/doc/extending-mysql/8.4/en/plugin-types.html#query-rewrite-plugin-type" target="_top">
Query Rewrite Plugins
</a>
). In this case, the
<a class="link" href="server-options.html#option_mysqld_log-raw">
<code class="option">
--log-raw
</code>
</a>
option affects
statement logging as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Without
<a class="link" href="server-options.html#option_mysqld_log-raw">
<code class="option">
--log-raw
</code>
</a>
, the server
logs the statement returned by the query rewrite plugin.
This may differ from the statement as received.
</p>
</li>
<li class="listitem">
<p>
With
<a class="link" href="server-options.html#option_mysqld_log-raw">
<code class="option">
--log-raw
</code>
</a>
, the server
logs the original statement as received.
</p>
</li>
</ul>
</div>
<p>
An implication of password rewriting is that statements that
cannot be parsed (due, for example, to syntax errors) are not
written to the general query log because they cannot be known to
be password free. Use cases that require logging of all
statements including those with errors should use the
<a class="link" href="server-options.html#option_mysqld_log-raw">
<code class="option">
--log-raw
</code>
</a>
option, bearing in mind
that this also bypasses password rewriting.
</p>
<p>
Password rewriting occurs only when plain text passwords are
expected. For statements with syntax that expect a password hash
value, no rewriting occurs. If a plain text password is supplied
erroneously for such syntax, the password is logged as given,
without rewriting.
</p>
<p>
To guard log files against unwarranted exposure, locate them in
a directory that restricts access to the server and the database
administrator. If the server logs to tables in the
<code class="literal">
mysql
</code>
database, grant access to those tables
only to the database administrator.
</p>
<p>
Replicas store the password for the replication source server in
their connection metadata repository, which by default is a
table in the
<code class="literal">
mysql
</code>
database named
<code class="literal">
slave_master_info
</code>
. The use of a file in the
data directory for the connection metadata repository is now
deprecated, but still possible (see
<a class="xref" href="replica-logs.html" title="19.2.4 Relay Log and Replication Metadata Repositories">
Section 19.2.4, “Relay Log and Replication Metadata Repositories”
</a>
). Ensure that the connection
metadata repository can be accessed only by the database
administrator. An alternative to storing the password in the
connection metadata repository is to use the
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
or
<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
to specify credentials for connecting to the source.
</p>
<p>
Use a restricted access mode to protect database backups that
include log tables or log files containing passwords.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-user-variable-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-user-variable-tables">
</a>
29.12.10 Performance Schema User-Defined Variable Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045071796832">
</a>
<a class="indexterm" name="idm46045071795376">
</a>
<p>
The Performance Schema provides a
<a class="link" href="performance-schema-user-variable-tables.html" title="29.12.10 Performance Schema User-Defined Variable Tables">
<code class="literal">
user_variables_by_thread
</code>
</a>
table that
exposes user-defined variables. These are variables defined
within a specific session and include a
<code class="literal">
@
</code>
character preceding the name; see
<a class="xref" href="user-variables.html" title="11.4 User-Defined Variables">
Section 11.4, “User-Defined Variables”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-user-variable-tables.html" title="29.12.10 Performance Schema User-Defined Variable Tables">
<code class="literal">
user_variables_by_thread
</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">
THREAD_ID
</code>
</p>
<p>
The thread identifier of the session in which the variable
is defined.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VARIABLE_NAME
</code>
</p>
<p>
The variable name, without the leading
<code class="literal">
@
</code>
character.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VARIABLE_VALUE
</code>
</p>
<p>
The variable value.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-user-variable-tables.html" title="29.12.10 Performance Schema User-Defined Variable Tables">
<code class="literal">
user_variables_by_thread
</code>
</a>
table
has these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
VARIABLE_NAME
</code>
)
</p>
</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 not permitted
for the
<a class="link" href="performance-schema-user-variable-tables.html" title="29.12.10 Performance Schema User-Defined Variable Tables">
<code class="literal">
user_variables_by_thread
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/using-innodb-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="using-innodb-tables">
</a>
17.6.1.1 Creating InnoDB Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166868464">
</a>
<p>
<code class="literal">
InnoDB
</code>
tables are created using the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement; for
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa80760855"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CHAR</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">PRIMARY</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>InnoDB<span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
ENGINE=InnoDB
</code>
clause is not required when
<code class="literal">
InnoDB
</code>
is defined as the default storage
engine, which it is by default. However, the
<code class="literal">
ENGINE
</code>
clause is useful if the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement is to be
replayed on a different MySQL Server instance where the default
storage engine is not
<code class="literal">
InnoDB
</code>
or is unknown. You
can determine the default storage engine on a MySQL Server
instance by issuing the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8755225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@@default_storage_engine</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>
<span class="token output"><span class="token punctuation">|</span> @@default_storage_engine <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> InnoDB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">
InnoDB
</code>
tables are created in file-per-table
tablespaces by default. To create an
<code class="literal">
InnoDB
</code>
table in the
<code class="literal">
InnoDB
</code>
system tablespace, disable
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable before creating the table. To create an
<code class="literal">
InnoDB
</code>
table in a general tablespace, use
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
TABLESPACE
</code>
</a>
syntax. For more information, see
<a class="xref" href="innodb-tablespace.html" title="17.6.3 Tablespaces">
Section 17.6.3, “Tablespaces”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-tables-row-format">
</a>
Row Formats
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166848928">
</a>
<p>
The row format of an
<code class="literal">
InnoDB
</code>
table determines
how its rows are physically stored on disk.
<code class="literal">
InnoDB
</code>
supports four row formats, each with
different storage characteristics. Supported row formats include
<code class="literal">
REDUNDANT
</code>
,
<code class="literal">
COMPACT
</code>
,
<code class="literal">
DYNAMIC
</code>
, and
<code class="literal">
COMPRESSED
</code>
.
The
<code class="literal">
DYNAMIC
</code>
row format is the default. For
information about row format characteristics, see
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable defines the default row format. The row format of a
table can also be defined explicitly using the
<code class="literal">
ROW_FORMAT
</code>
table option in a
<code class="literal">
CREATE
TABLE
</code>
or
<code class="literal">
ALTER TABLE
</code>
statement. See
<a class="xref" href="innodb-row-format.html#innodb-row-format-defining" title="Defining the Row Format of a Table">
Defining the Row Format of a Table
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-tables-primary-key">
</a>
Primary Keys
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166835136">
</a>
<p>
It is recommended that you define a primary key for each table
that you create. When selecting primary key columns, choose
columns with the following characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Columns that are referenced by the most important queries.
</p>
</li>
<li class="listitem">
<p>
Columns that are never left blank.
</p>
</li>
<li class="listitem">
<p>
Columns that never have duplicate values.
</p>
</li>
<li class="listitem">
<p>
Columns that rarely if ever change value once inserted.
</p>
</li>
</ul>
</div>
<p>
For example, in a table containing information about people, you
would not create a primary key on
<code class="literal">
(firstname,
lastname)
</code>
because more than one person can have the
same name, a name column may be left blank, and sometimes people
change their names. With so many constraints, often there is not
an obvious set of columns to use as a primary key, so you create
a new column with a numeric ID to serve as all or part of the
primary key. You can declare an
<a class="link" href="glossary.html#glos_auto_increment" title="auto-increment">
auto-increment
</a>
column
so that ascending values are filled in automatically as rows are
inserted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10341892"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true"># The value of ID can act like a pointer between related items in different tables.</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t5 <span class="token punctuation">(</span>id <span class="token datatype">INT</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span> b <span class="token datatype">CHAR</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true"># The primary key can consist of more than one column. Any autoinc column must come first.</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t6 <span class="token punctuation">(</span>id <span class="token datatype">INT</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span> a <span class="token datatype">INT</span><span class="token punctuation">,</span> b <span class="token datatype">CHAR</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">,</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information about auto-increment columns, see
<a class="xref" href="innodb-auto-increment-handling.html" title="17.6.1.6 AUTO_INCREMENT Handling in InnoDB">
Section 17.6.1.6, “AUTO_INCREMENT Handling in InnoDB”
</a>
.
</p>
<p>
Although a table works correctly without defining a primary key,
the primary key is involved with many aspects of performance and
is a crucial design aspect for any large or frequently used
table. It is recommended that you always specify a primary key
in the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement. If
you create the table, load data, and then run
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
to add a primary key
later, that operation is much slower than defining the primary
key when creating the table. For more information about primary
keys, 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>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-viewing-table-properties">
</a>
Viewing InnoDB Table Properties
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166818752">
</a>
<p>
To view the properties of an
<code class="literal">
InnoDB
</code>
table,
issue a
<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>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43713873"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> <span class="token keyword">STATUS</span> <span class="token keyword">FROM</span> test <span class="token operator">LIKE</span> <span class="token string">'t%'</span> \G<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> 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>
Name<span class="token punctuation">:</span> t1
Engine<span class="token punctuation">:</span> InnoDB
Version<span class="token punctuation">:</span> 10
Row_format<span class="token punctuation">:</span> Dynamic
Rows<span class="token punctuation">:</span> 0
Avg_row_length<span class="token punctuation">:</span> 0
Data_length<span class="token punctuation">:</span> 16384
Max_data_length<span class="token punctuation">:</span> 0
Index_length<span class="token punctuation">:</span> 0
Data_free<span class="token punctuation">:</span> 0
Auto_increment<span class="token punctuation">:</span> NULL
Create_time<span class="token punctuation">:</span> 2021-02-18 12<span class="token punctuation">:</span>18<span class="token punctuation">:</span>28
Update_time<span class="token punctuation">:</span> NULL
Check_time<span class="token punctuation">:</span> NULL
Collation<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
Checksum<span class="token punctuation">:</span> NULL
Create_options<span class="token punctuation">:</span>
Comment<span class="token punctuation">:</span></span></code></pre>
</div>
<p>
For information about
<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>
output, 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>
.
</p>
<p>
You can also access
<code class="literal">
InnoDB
</code>
table properties
by querying the
<code class="literal">
InnoDB
</code>
Information Schema
system tables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46805907"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_TABLES <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">'test/t1'</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>
TABLE_ID<span class="token punctuation">:</span> 1144
NAME<span class="token punctuation">:</span> test/t1
FLAG<span class="token punctuation">:</span> 33
N_COLS<span class="token punctuation">:</span> 5
SPACE<span class="token punctuation">:</span> 30
ROW_FORMAT<span class="token punctuation">:</span> Dynamic
ZIP_PAGE_SIZE<span class="token punctuation">:</span> 0
SPACE_TYPE<span class="token punctuation">:</span> Single
INSTANT_COLS<span class="token punctuation">:</span> 0</span></code></pre>
</div>
<p>
For more information, 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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-host-summary.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-host-summary">
</a>
30.4.3.1 The host_summary and x$host_summary Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045063366704">
</a>
<a class="indexterm" name="idm46045063365248">
</a>
<a class="indexterm" name="idm46045063363760">
</a>
<a class="indexterm" name="idm46045063362272">
</a>
<p>
These views summarize statement activity, file I/O, and
connections, grouped by host.
</p>
<p>
The
<a class="link" href="sys-host-summary.html" title="30.4.3.1 The host_summary and x$host_summary Views">
<code class="literal">
host_summary
</code>
</a>
and
<a class="link" href="sys-host-summary.html" title="30.4.3.1 The host_summary and x$host_summary Views">
<code class="literal">
x$host_summary
</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">
statements
</code>
</p>
<p>
The total number of statements for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
statement_latency
</code>
</p>
<p>
The total wait time of timed statements for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
statement_avg_latency
</code>
</p>
<p>
The average wait time per timed statement for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table_scans
</code>
</p>
<p>
The total number of table scans for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
file_ios
</code>
</p>
<p>
The total number of file I/O events for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
file_io_latency
</code>
</p>
<p>
The total wait time of timed file I/O events for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_connections
</code>
</p>
<p>
The current number of connections for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_connections
</code>
</p>
<p>
The total number of connections for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
unique_users
</code>
</p>
<p>
The number of distinct users for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_memory
</code>
</p>
<p>
The current amount of allocated memory for the host.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_memory_allocated
</code>
</p>
<p>
The total amount of allocated memory for the host.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-transporter-details.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-transporter-details">
</a>
25.6.17.65 The ndbinfo transporter_details Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045087483584">
</a>
<p>
This table contains information about individual NDB
transporters, rather than aggregate information as shown by the
<a class="link" href="mysql-cluster-ndbinfo-transporters.html" title="25.6.17.66 The ndbinfo transporters Table">
<code class="literal">
transporters
</code>
</a>
table. The
<code class="literal">
transporter_details
</code>
table was added in NDB
8.4.0.
</p>
<p>
The
<code class="literal">
transporter_details
</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 data node's unique node ID in the cluster
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
block_instance
</code>
</p>
<p>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
trp_id
</code>
</p>
<p>
The transporter ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
remote_node_id
</code>
</p>
<p>
The remote data node's node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
status
</code>
</p>
<p>
Status of the connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
remote_address
</code>
</p>
<p>
Name or IP address of the remote host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
bytes_sent
</code>
</p>
<p>
Number of bytes sent using this connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
bytes_received
</code>
</p>
<p>
Number of bytes received using this connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
connect_count
</code>
</p>
<p>
Number of times connection established on this transporter
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
overloaded
</code>
</p>
<p>
1 if this transporter is currently overloaded, otherwise 0
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
overload_count
</code>
</p>
<p>
Number of times this transporter has entered overload state
since connecting
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
slowdown
</code>
</p>
<p>
1 if this transporter is in slowdown state, otherwise 0
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
slowdown_count
</code>
</p>
<p>
Number of times this transporter has entered slowdown state
since connecting
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
encrypted
</code>
</p>
<p>
If this transporter is connected using TLS, this column is
<code class="literal">
1
</code>
, otherwise it is
<code class="literal">
0
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sendbuffer_used_bytes
</code>
</p>
<p>
The amount, in bytes, of signal data currently awaiting send
by this transporter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sendbuffer_max_used_bytes
</code>
</p>
<p>
The maximum amount, in bytes, of signal data awaiting send
at any one time by this transporter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sendbuffer_alloc_bytes
</code>
</p>
<p>
Amount of send buffer, in bytes, currently allocated for
signal data storage for this transporter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sendbuffer_max_alloc_bytes
</code>
</p>
<p>
Maxmimum amount of send buffer, in bytes, allocated for
signal data storage at any one time for this transporter.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
type
</code>
</p>
<p>
The connection type used by this transporter
(
<code class="literal">
TCP
</code>
or
<code class="literal">
SHM
</code>
).
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
transporter_details
</code>
table displays a row
showing the status of each transporter in the cluster. See the
Notes for the
<a class="link" href="mysql-cluster-ndbinfo-transporters.html" title="25.6.17.66 The ndbinfo transporters Table">
<code class="literal">
transporters
</code>
</a>
table for more information about each of the columns in this
table.
</p>
<p>
The
<code class="literal">
sendbuffer_used_bytes
</code>
,
<code class="literal">
sendbuffer_max_used_bytes
</code>
,
<code class="literal">
sendbuffer_alloc_bytes
</code>
, and
<code class="literal">
sendbuffer_max_alloc_bytes
</code>
columns were added
in NDB 8.4.0. The
<code class="literal">
type
</code>
column was added in
NDB 8.4.1.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-table-import.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-table-import">
</a>
17.6.1.3 Importing InnoDB Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166726816">
</a>
<a class="indexterm" name="idm46045166725744">
</a>
<a class="indexterm" name="idm46045166724256">
</a>
<p>
This section describes how to import tables using the
<span class="emphasis">
<em>
Transportable Tablespaces
</em>
</span>
feature, which
permits importing tables, partitioned tables, or individual table
partitions that reside in file-per-table tablespaces. There are
many reasons why you might want to import tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To run reports on a non-production MySQL server instance to
avoid placing extra load on a production server.
</p>
</li>
<li class="listitem">
<p>
To copy data to a new replica server.
</p>
</li>
<li class="listitem">
<p>
To restore a table from a backed-up tablespace file.
</p>
</li>
<li class="listitem">
<p>
As a faster way of moving data than importing a dump file,
which requires reinserting data and rebuilding indexes.
</p>
</li>
<li class="listitem">
<p>
To move a data to a server with storage media that is better
suited to your storage requirements. For example, you might
move busy tables to an SSD device, or move large tables to a
high-capacity HDD device.
</p>
</li>
</ul>
</div>
<p>
The
<span class="emphasis">
<em>
Transportable Tablespaces
</em>
</span>
feature is
described under the following topics in this section:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-prerequsites" title="Prerequisites">
Prerequisites
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-example" title="Importing Tables">
Importing Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-partitioned-table" title="Importing Partitioned Tables">
Importing Partitioned Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-partitions" title="Importing Table Partitions">
Importing Table Partitions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-limitations" title="Limitations">
Limitations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-usage-notes" title="Usage Notes">
Usage Notes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-table-import.html#innodb-table-import-internals" title="Internals">
Internals
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-prerequsites">
</a>
Prerequisites
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable must be enabled, which it is by default.
</p>
</li>
<li class="listitem">
<p>
The page size of the tablespace must match the page size of
the destination MySQL server instance.
<code class="literal">
InnoDB
</code>
page size is defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
variable,
which is configured when initializing a MySQL server
instance.
</p>
</li>
<li class="listitem">
<p>
If the table has a foreign key relationship,
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
must be
disabled before executing
<code class="literal">
DISCARD
TABLESPACE
</code>
. Also, you should export all foreign
key related tables at the same logical point in time, as
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
IMPORT TABLESPACE
</code>
</a>
does not enforce foreign key
constraints on imported data. To do so, stop updating the
related tables, commit all transactions, acquire shared
locks on the tables, and perform the export operations.
</p>
</li>
<li class="listitem">
<p>
When importing a table from another MySQL server instance,
both MySQL server instances must have General Availability
(GA) status and must be the same version. Otherwise, the
table must be created on the same MySQL server instance into
which it is being imported.
</p>
</li>
<li class="listitem">
<p>
If the table was created in an external directory by
specifying the
<code class="literal">
DATA DIRECTORY
</code>
clause in
the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement,
the table that you replace on the destination instance must
be defined with the same
<code class="literal">
DATA DIRECTORY
</code>
clause. A schema mismatch error is reported if the clauses
do not match. To determine if the source table was defined
with a
<code class="literal">
DATA DIRECTORY
</code>
clause, 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>
to view the
table definition. For information about using the
<code class="literal">
DATA DIRECTORY
</code>
clause, see
<a class="xref" href="innodb-create-table-external.html" title="17.6.1.2 Creating Tables Externally">
Section 17.6.1.2, “Creating Tables Externally”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If a
<code class="literal">
ROW_FORMAT
</code>
option is not defined
explicitly in the table definition or
<code class="literal">
ROW_FORMAT=DEFAULT
</code>
is used, the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
setting must be the same on the source and destination
instances. Otherwise, a schema mismatch error is reported
when you attempt the import operation. 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>
to check
the table definition. Use
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW
VARIABLES
</code>
</a>
to check the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
setting. For related information, see
<a class="xref" href="innodb-row-format.html#innodb-row-format-defining" title="Defining the Row Format of a Table">
Defining the Row Format of a Table
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-example">
</a>
Importing Tables
</h5>
</div>
</div>
</div>
<p>
This example demonstrates how to import a regular
non-partitioned table that resides in a file-per-table
tablespace.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the destination instance, create a table with the same
definition as the table you intend to import. (You can
obtain the table definition using
<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>
syntax.) If the table definition does
not match, a schema mismatch error is reported when you
attempt the import operation.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11813193"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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 punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
On the destination instance, discard the tablespace of the
table that you just created. (Before importing, you must
discard the tablespace of the receiving table.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa73976568"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <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>
On the source instance, run
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
to quiesce the table you
intend to import. When a table is quiesced, only read-only
transactions are permitted on the table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32902837"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
ensures that changes to the
named table are flushed to disk so that a binary table copy
can be made while the server is running. When
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
is run,
<code class="literal">
InnoDB
</code>
generates a
<code class="filename">
.cfg
</code>
metadata file in the schema
directory of the table. The
<code class="filename">
.cfg
</code>
file
contains metadata that is used for schema verification
during the import operation.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The connection executing
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
must remain open while the
operation is running; otherwise, the
<code class="filename">
.cfg
</code>
file is removed as locks are
released upon connection closure.
</p>
</div>
</li>
<li class="listitem">
<p>
Copy the
<code class="filename">
.ibd
</code>
file and
<code class="filename">
.cfg
</code>
metadata file from the source
instance to the destination instance. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa58937115"><div class="copy-help left">Press ⌘+C to 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">scp</span> <em class="replaceable">/path/to/datadir</em>/test/t1<span class="token punctuation">.</span><span class="token punctuation">{</span>ibd<span class="token punctuation">,</span>cfg<span class="token punctuation">}</span> destination-server<span class="token punctuation">:</span><em class="replaceable">/path/to/datadir</em>/test</code></pre>
</div>
<p>
The
<code class="filename">
.ibd
</code>
file and
<code class="filename">
.cfg
</code>
file must be copied before
releasing the shared locks, as described in the next step.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you are importing a table from an encrypted tablespace,
<code class="literal">
InnoDB
</code>
generates a
<code class="filename">
.cfp
</code>
file in addition to a
<code class="filename">
.cfg
</code>
metadata file. The
<code class="filename">
.cfp
</code>
file must be copied to the
destination instance together with the
<code class="filename">
.cfg
</code>
file. The
<code class="filename">
.cfp
</code>
file contains a transfer key and
an encrypted tablespace key. On import,
<code class="literal">
InnoDB
</code>
uses the transfer key to decrypt
the tablespace key. For related information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
On the source instance, use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
to release the locks acquired by the
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15553509"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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>
The
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
operation also removes the
<code class="filename">
.cfg
</code>
file.
</p>
</li>
<li class="listitem">
<p>
On the destination instance, import the tablespace:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98759167"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-partitioned-table">
</a>
Importing Partitioned Tables
</h5>
</div>
</div>
</div>
<p>
This example demonstrates how to import a partitioned table,
where each table partition resides in a file-per-table
tablespace.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the destination instance, create a partitioned table with
the same definition as the partitioned table that you want
to import. (You can obtain the table definition using
<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>
syntax.) If
the table definition does not match, a schema mismatch error
is reported when you attempt the import operation.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96699336"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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>i <span class="token datatype">int</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">PARTITIONS</span> <span class="token number">3</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In the
<code class="literal">
/
<em class="replaceable">
<code>
datadir
</code>
</em>
/test
</code>
directory, there is a tablespace
<code class="filename">
.ibd
</code>
file for each of the three partitions.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa40559297"><div class="copy-help left">Press ⌘+C to 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"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd t1#p#p1.ibd t1#p#p2.ibd</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
On the destination instance, discard the tablespace for the
partitioned table. (Before the import operation, you must
discard the tablespace of the receiving table.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88626999"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">DISCARD</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The three tablespace
<code class="filename">
.ibd
</code>
files of the
partitioned table are discarded from the
<code class="literal">
/
<em class="replaceable">
<code>
datadir
</code>
</em>
/test
</code>
directory.
</p>
</li>
<li class="listitem">
<p>
On the source instance, run
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
to quiesce the partitioned
table that you intend to import. When a table is quiesced,
only read-only transactions are permitted on the table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69170406"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
ensures that changes to the
named table are flushed to disk so that binary table copy
can be made while the server is running. When
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
is run,
<code class="literal">
InnoDB
</code>
generates
<code class="filename">
.cfg
</code>
metadata files in the schema
directory of the table for each of the table's tablespace
files.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83946914"><div class="copy-help left">Press ⌘+C to 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"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd t1#p#p1.ibd t1#p#p2.ibd</span>
t1<span class="token comment" spellcheck="true">#p#p0.cfg t1#p#p1.cfg t1#p#p2.cfg</span></code></pre>
</div>
<p>
The
<code class="filename">
.cfg
</code>
files contain metadata that is
used for schema verification when importing the tablespace.
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
can only be run on the
table, not on individual table partitions.
</p>
</li>
<li class="listitem">
<p>
Copy the
<code class="filename">
.ibd
</code>
and
<code class="filename">
.cfg
</code>
files from the source instance
schema directory to the destination instance schema
directory. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa89120728"><div class="copy-help left">Press ⌘+C to 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">$>scp <em class="replaceable">/path/to/datadir</em>/test/t1*<span class="token punctuation">.</span><span class="token punctuation">{</span>ibd<span class="token punctuation">,</span>cfg<span class="token punctuation">}</span> destination-server<span class="token punctuation">:</span><em class="replaceable">/path/to/datadir</em>/test</code></pre>
</div>
<p>
The
<code class="filename">
.ibd
</code>
and
<code class="filename">
.cfg
</code>
files must be copied before releasing the shared locks, as
described in the next step.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you are importing a table from an encrypted tablespace,
<code class="literal">
InnoDB
</code>
generates a
<code class="filename">
.cfp
</code>
files in addition to a
<code class="filename">
.cfg
</code>
metadata files. The
<code class="filename">
.cfp
</code>
files must be copied to the
destination instance together with the
<code class="filename">
.cfg
</code>
files. The
<code class="filename">
.cfp
</code>
files contain a transfer key and
an encrypted tablespace key. On import,
<code class="literal">
InnoDB
</code>
uses the transfer key to decrypt
the tablespace key. For related information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
On the source instance, use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
to release the locks acquired by
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43920461"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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>
</li>
<li class="listitem">
<p>
On the destination instance, import the tablespace of the
partitioned table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36538825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-partitions">
</a>
Importing Table Partitions
</h5>
</div>
</div>
</div>
<p>
This example demonstrates how to import individual table
partitions, where each partition resides in a file-per-table
tablespace file.
</p>
<p>
In the following example, two partitions (
<code class="literal">
p2
</code>
and
<code class="literal">
p3
</code>
) of a four-partition table are
imported.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the destination instance, create a partitioned table with
the same definition as the partitioned table that you want
to import partitions from. (You can obtain the table
definition using
<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>
syntax.) If the table definition does not
match, a schema mismatch error is reported when you attempt
the import operation.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11461249"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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>i <span class="token datatype">int</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">PARTITIONS</span> <span class="token number">4</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In the
<code class="literal">
/
<em class="replaceable">
<code>
datadir
</code>
</em>
/test
</code>
directory, there is a tablespace
<code class="filename">
.ibd
</code>
file for each of the four partitions.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa81549461"><div class="copy-help left">Press ⌘+C to 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"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd t1#p#p1.ibd t1#p#p2.ibd t1#p#p3.ibd</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
On the destination instance, discard the partitions that you
intend to import from the source instance. (Before importing
partitions, you must discard the corresponding partitions
from the receiving partitioned table.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa3197096"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">DISCARD</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The tablespace
<code class="literal">
.ibd
</code>
files for the two
discarded partitions are removed from the
<code class="literal">
/
<em class="replaceable">
<code>
datadir
</code>
</em>
/test
</code>
directory on the destination instance, leaving the following
files:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa56833927"><div class="copy-help left">Press ⌘+C to 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"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd t1#p#p1.ibd</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE ... DISCARD PARTITION ... TABLESPACE
</code>
</a>
is
run on subpartitioned tables, both partition and
subpartition table names are permitted. When a partition
name is specified, subpartitions of that partition are
included in the operation.
</p>
</div>
</li>
<li class="listitem">
<p>
On the source instance, run
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
to quiesce the partitioned
table. When a table is quiesced, only read-only transactions
are permitted on the table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10303444"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
ensures that changes to the
named table are flushed to disk so that binary table copy
can be made while the instance is running. When
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
is run,
<code class="literal">
InnoDB
</code>
generates a
<code class="filename">
.cfg
</code>
metadata file for each of the
table's tablespace files in the schema directory of the
table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa3224582"><div class="copy-help left">Press ⌘+C to 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"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd t1#p#p1.ibd t1#p#p2.ibd t1#p#p3.ibd</span>
t1<span class="token comment" spellcheck="true">#p#p0.cfg t1#p#p1.cfg t1#p#p2.cfg t1#p#p3.cfg</span></code></pre>
</div>
<p>
The
<code class="filename">
.cfg
</code>
files contain metadata that
used for schema verification during the import operation.
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
can only be run on the
table, not on individual table partitions.
</p>
</li>
<li class="listitem">
<p>
Copy the
<code class="filename">
.ibd
</code>
and
<code class="filename">
.cfg
</code>
files for partition
<code class="literal">
p2
</code>
and partition
<code class="literal">
p3
</code>
from the source instance schema directory to the destination
instance schema directory.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa14633015"><div class="copy-help left">Press ⌘+C to 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">scp</span> t1<span class="token comment" spellcheck="true">#p#p2.ibd t1#p#p2.cfg t1#p#p3.ibd t1#p#p3.cfg destination-server:<em class="replaceable">/path/to/datadir</em>/test</span></code></pre>
</div>
<p>
The
<code class="filename">
.ibd
</code>
and
<code class="filename">
.cfg
</code>
files must be copied before releasing the shared locks, as
described in the next step.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you are importing partitions from an encrypted
tablespace,
<code class="literal">
InnoDB
</code>
generates a
<code class="filename">
.cfp
</code>
files in addition to a
<code class="filename">
.cfg
</code>
metadata files. The
<code class="filename">
.cfp
</code>
files must be copied to the
destination instance together with the
<code class="filename">
.cfg
</code>
files. The
<code class="filename">
.cfp
</code>
files contain a transfer key and
an encrypted tablespace key. On import,
<code class="literal">
InnoDB
</code>
uses the transfer key to decrypt
the tablespace key. For related information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
On the source instance, use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
UNLOCK
TABLES
</code>
</a>
to release the locks acquired by
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69950741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<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>
</li>
<li class="listitem">
<p>
On the destination instance, import table partitions
<code class="literal">
p2
</code>
and
<code class="literal">
p3
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81255421"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</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>
When
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE ... IMPORT PARTITION ... TABLESPACE
</code>
</a>
is run
on subpartitioned tables, both partition and subpartition
table names are permitted. When a partition name is
specified, subpartitions of that partition are included in
the operation.
</p>
</div>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-limitations">
</a>
Limitations
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<span class="emphasis">
<em>
Transportable Tablespaces
</em>
</span>
feature
is only supported for tables that reside in file-per-table
tablespaces. It is not supported for the tables that reside
in the system tablespace or general tablespaces. Tables in
shared tablespaces cannot be quiesced.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
is not supported on tables
with a
<code class="literal">
FULLTEXT
</code>
index, as full-text
search auxiliary tables cannot be flushed. After importing a
table with a
<code class="literal">
FULLTEXT
</code>
index, run
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
to rebuild the
<code class="literal">
FULLTEXT
</code>
indexes. Alternatively, drop
<code class="literal">
FULLTEXT
</code>
indexes before the export
operation and recreate the indexes after importing the table
on the destination instance.
</p>
</li>
<li class="listitem">
<p>
Due to a
<code class="literal">
.cfg
</code>
metadata file limitation,
schema mismatches are not reported for partition type or
partition definition differences when importing a
partitioned table. Column differences are reported.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-usage-notes">
</a>
Usage Notes
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With the exception of tables that contain instantly added or
dropped columns,
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
IMPORT TABLESPACE
</code>
</a>
does not require a
<code class="filename">
.cfg
</code>
metadata file to import a table.
However, metadata checks are not performed when importing
without a
<code class="filename">
.cfg
</code>
file, and a warning
similar to the following is issued:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa37317852"><div class="copy-help left">Press ⌘+C to 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">Message: InnoDB: IO Read error: (2, No such file or directory) Error opening '.\
test\t.cfg', will attempt to import without schema verification
1 row in set (0.00 sec)</code></pre>
</div>
<p>
Importing a table without a
<code class="filename">
.cfg
</code>
metadata file should only be considered if no schema
mismatches are expected and the table does not contain any
instantly added or dropped columns. The ability to import
without a
<code class="filename">
.cfg
</code>
file could be useful in
crash recovery scenarios where metadata is not accessible.
</p>
<p>
Attempting to import a table with columns that were added or
dropped using
<code class="literal">
ALGORITHM=INSTANT
</code>
without
using a
<code class="filename">
.cfg
</code>
file can result in
undefined behavior.
</p>
</li>
<li class="listitem">
<p>
On Windows,
<code class="literal">
InnoDB
</code>
stores database,
tablespace, and table names internally in lowercase. To
avoid import problems on case-sensitive operating systems
such as Linux and Unix, create all databases, tablespaces,
and tables using lowercase names. A convenient way to ensure
that names are created in lowercase is to set
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
to 1
before initializing the server. (It is prohibited to start
the server with a
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting that is different from the setting used when the
server was initialized.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa87072305"><div class="copy-help left">Press ⌘+C to 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">[mysqld]
lower_case_table_names=1</code></pre>
</div>
</li>
<li class="listitem">
<p>
When running
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
DISCARD PARTITION ... TABLESPACE
</code>
</a>
and
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
IMPORT PARTITION ... TABLESPACE
</code>
</a>
on subpartitioned
tables, both partition and subpartition table names are
permitted. When a partition name is specified, subpartitions
of that partition are included in the operation.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-table-import-internals">
</a>
Internals
</h5>
</div>
</div>
</div>
<p>
The following information describes internals and messages
written to the error log during a table import procedure.
</p>
<p>
When
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
... DISCARD TABLESPACE
</code>
</a>
is run on the destination
instance:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The table is locked in X mode.
</p>
</li>
<li class="listitem">
<p>
The tablespace is detached from the table.
</p>
</li>
</ul>
</div>
<p>
When
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
is run on the source instance:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The table being flushed for export is locked in shared mode.
</p>
</li>
<li class="listitem">
<p>
The purge coordinator thread is stopped.
</p>
</li>
<li class="listitem">
<p>
Dirty pages are synchronized to disk.
</p>
</li>
<li class="listitem">
<p>
Table metadata is written to the binary
<code class="filename">
.cfg
</code>
file.
</p>
</li>
</ul>
</div>
<p>
Expected error log messages for this operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa57015015"><div class="copy-help left">Press ⌘+C to 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] InnoDB: Sync to disk of '"test"."t1"' started.
[Note] InnoDB: Stopping purge
[Note] InnoDB: Writing table metadata to './test/t1.cfg'
[Note] InnoDB: Table '"test"."t1"' flushed to disk</code></pre>
</div>
<p>
When
<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 run on the source instance:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The binary
<code class="literal">
.cfg
</code>
file is deleted.
</p>
</li>
<li class="listitem">
<p>
The shared lock on the table or tables being imported is
released and the purge coordinator thread is restarted.
</p>
</li>
</ul>
</div>
<p>
Expected error log messages for this operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa80755193"><div class="copy-help left">Press ⌘+C to 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] InnoDB: Deleting the meta-data file './test/t1.cfg'
[Note] InnoDB: Resuming purge</code></pre>
</div>
<p>
When
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
... IMPORT TABLESPACE
</code>
</a>
is run on the destination
instance, the import algorithm performs the following operations
for each tablespace being imported:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Each tablespace page is checked for corruption.
</p>
</li>
<li class="listitem">
<p>
The space ID and log sequence numbers (LSNs) on each page
are updated.
</p>
</li>
<li class="listitem">
<p>
Flags are validated and LSN updated for the header page.
</p>
</li>
<li class="listitem">
<p>
Btree pages are updated.
</p>
</li>
<li class="listitem">
<p>
The page state is set to dirty so that it is written to
disk.
</p>
</li>
</ul>
</div>
<p>
Expected error log messages for this operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa41480151"><div class="copy-help left">Press ⌘+C to 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] InnoDB: Importing tablespace for table 'test/t1' that was exported
from host '<em class="replaceable">host_name</em>'
[Note] InnoDB: Phase I - Update all pages
[Note] InnoDB: Sync to disk
[Note] InnoDB: Sync to disk - done!
[Note] InnoDB: Phase III - Flush changes to disk
[Note] InnoDB: Phase IV - Flush complete</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You may also receive a warning that a tablespace is discarded
(if you discarded the tablespace for the destination table)
and a message stating that statistics could not be calculated
due to a missing
<code class="filename">
.ibd
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa49039601"><div class="copy-help left">Press ⌘+C to 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] InnoDB: Table "test"."t1" tablespace is set as discarded.
7f34d9a37700 InnoDB: cannot calculate statistics for table
"test"."t1" because the .ibd file is missing. For help, please refer to
http://dev.mysql.com/doc/refman/en/innodb-troubleshooting.html</code></pre>
</div>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-asynchronous-connection-failover-replica.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-asynchronous-connection-failover-replica">
</a>
19.4.9.2 Asynchronous Connection Failover for Replicas
</h4>
</div>
</div>
</div>
<p>
Asynchronous connection failover for replicas is activated
automatically for a replication channel on a Group Replication
primary when you set
<a class="link" href="change-replication-source-to.html#crs-opt-source_connection_auto_failover">
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=1
</code>
</a>
in 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 for the channel. The feature is designed
for a group of senders and a group of receivers to keep
synchronized with each other even when some members are
temporarily unavailable. When the feature is active and
correctly configured, if the primary that is replicating goes
offline or into an error state, the new primary starts
replication on the same channel when it is elected. The new
primary uses the source list for the channel to select the
source with the highest priority (weight) setting, which might
not be the same as the original source.
</p>
<p>
To configure this feature, the replication channel and the
replication user account and password for the channel must be
set up on all the member servers in the replication group, and
on any new joining members. Ensure that
<a class="link" href="change-replication-source-to.html#crs-opt-source_retry_count">
<code class="literal">
SOURCE_RETRY_COUNT
</code>
</a>
and
<a class="link" href="change-replication-source-to.html#crs-opt-source_connect_retry">
<code class="literal">
SOURCE_CONNECT_RETRY
</code>
</a>
are set to
minimal numbers that just allow a few retry attempts, for
example 3 and 10. You can set up the replication channel using
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
, or if the new
servers are provisioned using MySQL's clone functionality,
this all happens automatically. The
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER
</code>
setting for
the channel is broadcast to group members from the primary when
they join. If you later disable
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER
</code>
for the
channel on the primary, this is also broadcast to the secondary
servers, and they change the status of the channel to match.
</p>
<p>
Asynchronous connection failover for replicas is activated and
deactivated using the Group Replication member action
<code class="literal">
mysql_start_failover_channels_if_primary
</code>
,
which is enabled by default. You can disable it for the whole
group by disabling that member action on the primary, 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, as in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa42307891"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> group_replication_disable_member_action<span class="token punctuation">(</span><span class="token string">"mysql_start_failover_channels_if_primary"</span><span class="token punctuation">,</span> <span class="token string">"AFTER_PRIMARY_ELECTION"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The function can only be changed on a primary, and must be
enabled or disabled for the whole group, so you cannot have some
members providing failover and others not. When the
<code class="literal">
mysql_start_failover_channels_if_primary
</code>
member action is disabled, the channel does not need to be
configured on secondary members, but if the primary goes offline
or into an error state, replication stops for the channel. Note
that if there is more than one channel with
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=1
</code>
, the
member action covers all the channels, so they cannot be
individually enabled and disabled by that method. Set
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=0
</code>
on the
primary to disable an individual channel.
</p>
<p>
The source list for a channel with
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=1
</code>
is
broadcast to all group members when they join, and also when it
changes. This is the case whether the sources are a managed
group for which the membership is updated automatically, or
whether they are added or changed manually using
<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>
,
<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>
,
<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>
,
or
<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>
.
All group members receive the current source list as recorded in
the
<code class="literal">
mysql.replication_asynchronous_connection_failover
</code>
and
<code class="literal">
mysql.replication_asynchronous_connection_failover_managed
</code>
tables. Because the sources do not have to be in a managed
group, you can set up the function to synchronize a group of
receivers with one or more alternative standalone senders, or
even a single sender. A standalone replica that is not part of a
replication group cannot use this feature.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/alter-user.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="alter-user">
</a>
15.7.1.1 ALTER USER Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045175181984">
</a>
<a class="indexterm" name="idm46045175180912">
</a>
<a class="indexterm" name="idm46045175179424">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38692132"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<span class="token keyword"><em class="replaceable">user</em></span> <span class="token punctuation">[</span><em class="replaceable">auth_option</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">user</em></span> <span class="token punctuation">[</span><em class="replaceable">auth_option</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">REQUIRE</span> {<span class="token keyword">NONE</span> <span class="token operator">|</span> <em class="replaceable">tls_option</em> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token operator">AND</span><span class="token punctuation">]</span> <em class="replaceable">tls_option</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">WITH</span> <em class="replaceable">resource_option</em> <span class="token punctuation">[</span><em class="replaceable">resource_option</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">password_option</em> <span class="token operator">|</span> <em class="replaceable">lock_option</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">COMMENT</span> <span class="token string">'<em class="replaceable">comment_string</em>'</span> <span class="token operator">|</span> <span class="token keyword">ATTRIBUTE</span> <span class="token string">'<em class="replaceable">json_object</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<span class="token function">USER</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <em class="replaceable">user_func_auth_option</em>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<span class="token keyword"><em class="replaceable">user</em></span> <span class="token punctuation">[</span><em class="replaceable">registration_option</em><span class="token punctuation">]</span>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<span class="token function">USER</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">[</span><em class="replaceable">registration_option</em><span class="token punctuation">]</span>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<span class="token keyword"><em class="replaceable">user</em></span> <span class="token keyword">DEFAULT</span> <span class="token keyword">ROLE</span>
{<span class="token keyword">NONE</span> <span class="token operator">|</span> <span class="token keyword">ALL</span> <span class="token operator">|</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">role</em></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"><em class="replaceable">user</em></span>:
<span class="token punctuation">(</span>see Section <span class="token number">8.2</span><span class="token punctuation">.</span><span class="token number">4</span><span class="token punctuation">,</span> “Specifying <span class="token keyword">Account</span> <span class="token keyword">Names</span>”<span class="token punctuation">)</span>
<em class="replaceable">auth_option</em>: {
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_auth_string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token keyword">RANDOM</span> <span class="token keyword">PASSWORD</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_auth_string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_auth_string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">BY</span> <span class="token keyword">RANDOM</span> <span class="token keyword">PASSWORD</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_auth_string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">AS</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token operator">|</span> <span class="token keyword">DISCARD</span> <span class="token keyword">OLD</span> <span class="token keyword">PASSWORD</span>
<span class="token operator">|</span> <span class="token keyword">ADD</span> <em class="replaceable">factor</em> <em class="replaceable">factor_auth_option</em> <span class="token punctuation">[</span><span class="token keyword">ADD</span> <em class="replaceable">factor</em> <em class="replaceable">factor_auth_option</em><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">MODIFY</span> <em class="replaceable">factor</em> <em class="replaceable">factor_auth_option</em> <span class="token punctuation">[</span><span class="token keyword">MODIFY</span> <em class="replaceable">factor</em> <em class="replaceable">factor_auth_option</em><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">DROP</span> <em class="replaceable">factor</em> <span class="token punctuation">[</span><span class="token keyword">DROP</span> <em class="replaceable">factor</em><span class="token punctuation">]</span>
}
<em class="replaceable">user_func_auth_option</em>: {
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_auth_string</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">DISCARD</span> <span class="token keyword">OLD</span> <span class="token keyword">PASSWORD</span>
}
<em class="replaceable">factor_auth_option</em>: {
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token keyword">RANDOM</span> <span class="token keyword">PASSWORD</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">BY</span> <span class="token keyword">RANDOM</span> <span class="token keyword">PASSWORD</span>
<span class="token operator">|</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> <em class="replaceable">auth_plugin</em> <span class="token keyword">AS</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
}
<em class="replaceable">registration_option</em>: {
<em class="replaceable">factor</em> INITIATE REGISTRATION
<span class="token operator">|</span> <em class="replaceable">factor</em> FINISH REGISTRATION <span class="token keyword">SET</span> CHALLENGE_RESPONSE <span class="token keyword">AS</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span>
<span class="token operator">|</span> <em class="replaceable">factor</em> UNREGISTER
}
<em class="replaceable">factor</em>: {<span class="token number">2</span> <span class="token operator">|</span> <span class="token number">3</span>} FACTOR
<em class="replaceable">tls_option</em>: {
<span class="token keyword">SSL</span>
<span class="token operator">|</span> <span class="token keyword">X509</span>
<span class="token operator">|</span> <span class="token keyword">CIPHER</span> <span class="token string">'<em class="replaceable">cipher</em>'</span>
<span class="token operator">|</span> <span class="token keyword">ISSUER</span> <span class="token string">'<em class="replaceable">issuer</em>'</span>
<span class="token operator">|</span> <span class="token keyword">SUBJECT</span> <span class="token string">'<em class="replaceable">subject</em>'</span>
}
<em class="replaceable">resource_option</em>: {
<span class="token keyword">MAX_QUERIES_PER_HOUR</span> <em class="replaceable">count</em>
<span class="token operator">|</span> <span class="token keyword">MAX_UPDATES_PER_HOUR</span> <em class="replaceable">count</em>
<span class="token operator">|</span> <span class="token keyword">MAX_CONNECTIONS_PER_HOUR</span> <em class="replaceable">count</em>
<span class="token operator">|</span> <span class="token keyword">MAX_USER_CONNECTIONS</span> <em class="replaceable">count</em>
}
<em class="replaceable">password_option</em>: {
<span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span> <span class="token punctuation">[</span><span class="token keyword">DEFAULT</span> <span class="token operator">|</span> <span class="token keyword">NEVER</span> <span class="token operator">|</span> <span class="token keyword">INTERVAL</span> <em class="replaceable">N</em> <span class="token keyword">DAY</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">HISTORY</span> {<span class="token keyword">DEFAULT</span> <span class="token operator">|</span> <em class="replaceable">N</em>}
<span class="token operator">|</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REUSE</span> <span class="token keyword">INTERVAL</span> {<span class="token keyword">DEFAULT</span> <span class="token operator">|</span> <em class="replaceable">N</em> <span class="token keyword">DAY</span>}
<span class="token operator">|</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">CURRENT</span> <span class="token punctuation">[</span><span class="token keyword">DEFAULT</span> <span class="token operator">|</span> <span class="token keyword">OPTIONAL</span><span class="token punctuation">]</span>
<span class="token operator">|</span> <span class="token keyword">FAILED_LOGIN_ATTEMPTS</span> <em class="replaceable">N</em>
<span class="token operator">|</span> <span class="token keyword">PASSWORD_LOCK_TIME</span> {<em class="replaceable">N</em> <span class="token operator">|</span> <span class="token keyword">UNBOUNDED</span>}
}
<em class="replaceable">lock_option</em>: {
<span class="token keyword">ACCOUNT</span> <span class="token keyword">LOCK</span>
<span class="token operator">|</span> <span class="token keyword">ACCOUNT</span> <span class="token keyword">UNLOCK</span>
}</code></pre>
</div>
<p>
The
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement modifies
MySQL accounts. It enables authentication, role, SSL/TLS,
resource-limit, password-management, comment, and attribute
properties to be modified for existing accounts. It can also be
used to lock and unlock accounts.
</p>
<p>
In most cases,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
requires the global
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege, or the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for the
<code class="literal">
mysql
</code>
system schema. The
exceptions are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Any client who connects to the server using a nonanonymous
account can change the password for that account. (In
particular, you can change your own password.) To see which
account the server authenticated you as, invoke the
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
function:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12125052"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CURRENT_USER</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For
<code class="literal">
DEFAULT ROLE
</code>
syntax,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
requires these
privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Setting the default roles for another user requires the
global
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege, or the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for the
<code class="literal">
mysql.default_roles
</code>
system table.
</p>
</li>
<li class="listitem">
<p>
Setting the default roles for yourself requires no
special privileges, as long as the roles you want as the
default have been granted to you.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Statements that modify secondary passwords require these
privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_application-password-admin">
<code class="literal">
APPLICATION_PASSWORD_ADMIN
</code>
</a>
privilege is required to use the
<code class="literal">
RETAIN CURRENT
PASSWORD
</code>
or
<code class="literal">
DISCARD OLD
PASSWORD
</code>
clause for
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
statements that apply to your own
account. The privilege is required to manipulate your
own secondary password because most users require only
one password.
</p>
</li>
<li class="listitem">
<p>
If an account is to be permitted to manipulate secondary
passwords for all accounts, it requires the
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege
rather than
<a class="link" href="privileges-provided.html#priv_application-password-admin">
<code class="literal">
APPLICATION_PASSWORD_ADMIN
</code>
</a>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
When the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
system
variable is enabled,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
additionally requires 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).
</p>
<p>
These additional privilege considerations also apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
system variable places certain constraints on how the
authentication-related clauses of
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
statements may be used; for details, see the
description of that variable. These constraints do not apply
if you have the
<a class="link" href="privileges-provided.html#priv_authentication-policy-admin">
<code class="literal">
AUTHENTICATION_POLICY_ADMIN
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
To modify an account that uses passwordless authentication,
you must have the
<a class="link" href="privileges-provided.html#priv_passwordless-user-admin">
<code class="literal">
PASSWORDLESS_USER_ADMIN
</code>
</a>
privilege.
</p>
</li>
</ul>
</div>
<p>
By default, an error occurs if you try to modify a user that
does not exist. If the
<code class="literal">
IF EXISTS
</code>
clause is
given, the statement produces a warning for each named user that
does not exist, rather than an error.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Under some circumstances,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
may be recorded in server logs or on the client
side in a history file such as
<code class="filename">
~/.mysql_history
</code>
, which means that
cleartext passwords may be read by anyone having read access
to that information. For information about the conditions
under which this occurs for the server logs and how to control
it, see
<a class="xref" href="password-logging.html" title="8.1.2.3 Passwords and Logging">
Section 8.1.2.3, “Passwords and Logging”
</a>
. For similar
information about client-side logging, see
<a class="xref" href="mysql-logging.html" title="6.5.1.3 mysql Client Logging">
Section 6.5.1.3, “mysql Client Logging”
</a>
.
</p>
</div>
<p>
There are several aspects to the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
statement, described under the following topics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-overview" title="ALTER USER Overview">
ALTER USER Overview
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-authentication" title="ALTER USER Authentication Options">
ALTER USER Authentication Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-multifactor-authentication" title="ALTER USER Multifactor Authentication Options">
ALTER USER Multifactor Authentication Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-registration-" title="ALTER USER Registration Options">
ALTER USER Registration Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-role" title="ALTER USER Role Options">
ALTER USER Role Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-tls" title="ALTER USER SSL/TLS Options">
ALTER USER SSL/TLS Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-resource-limits" title="ALTER USER Resource-Limit Options">
ALTER USER Resource-Limit Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-password-management" title="ALTER USER Password-Management Options">
ALTER USER Password-Management Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-comments-attributes" title="ALTER USER Comment and Attribute Options">
ALTER USER Comment and Attribute Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-account-locking" title="ALTER USER Account-Locking Options">
ALTER USER Account-Locking Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="alter-user.html#alter-user-binary-logging" title="ALTER USER Binary Logging">
ALTER USER Binary Logging
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-overview">
</a>
ALTER USER Overview
</h5>
</div>
</div>
</div>
<p>
For each affected account,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
modifies the corresponding row in the
<code class="literal">
mysql.user
</code>
system table to reflect the
properties specified in the statement. Unspecified properties
retain their current values.
</p>
<p>
Each account name uses the format described in
<a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
Section 8.2.4, “Specifying Account Names”
</a>
. The host name part of the
account name, if omitted, defaults to
<code class="literal">
'%'
</code>
.
It is also possible to specify
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER
</code>
</a>
or
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
to refer to the
account associated with the current session.
</p>
<p>
In one case only, the account may be specified with the
<a class="link" href="information-functions.html#function_user">
<code class="literal">
USER()
</code>
</a>
function:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa18922035"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token function">USER</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">auth_string</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This syntax enables changing your own password without naming
your account literally. (The syntax also supports the
<code class="literal">
REPLACE
</code>
,
<code class="literal">
RETAIN CURRENT
PASSWORD
</code>
, and
<code class="literal">
DISCARD OLD
PASSWORD
</code>
clauses described at
<a class="xref" href="alter-user.html#alter-user-authentication" title="ALTER USER Authentication Options">
ALTER USER Authentication Options
</a>
.)
</p>
<p>
For
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
syntax that
permits an
<em class="replaceable">
<code>
auth_option
</code>
</em>
value to
follow a
<em class="replaceable">
<code>
user
</code>
</em>
value,
<em class="replaceable">
<code>
auth_option
</code>
</em>
indicates how the
account authenticates by specifying an account authentication
plugin, credentials (for example, a password), or both. Each
<em class="replaceable">
<code>
auth_option
</code>
</em>
value applies
<span class="emphasis">
<em>
only
</em>
</span>
to the account named immediately
preceding it.
</p>
<p>
Following the
<em class="replaceable">
<code>
user
</code>
</em>
specifications,
the statement may include options for SSL/TLS, resource-limit,
password-management, and locking properties. All such options
are
<span class="emphasis">
<em>
global
</em>
</span>
to the statement and apply to
<span class="emphasis">
<em>
all
</em>
</span>
accounts named in the statement.
</p>
<p>
Example: Change an account's password and expire it. As a
result, the user must connect with the named password and
choose a new one at the next connection:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43628458"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</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">new_password</em>'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Modify an account to use the
<code class="literal">
caching_sha2_password
</code>
authentication plugin
and the given password. Require that a new password be chosen
every 180 days, and enable failed-login tracking, such that
three consecutive incorrect passwords cause temporary account
locking for two days:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64407051"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> caching_sha2_password <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">new_password</em>'</span>
<span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span> <span class="token keyword">INTERVAL</span> <span class="token number">180</span> <span class="token keyword">DAY</span>
<span class="token keyword">FAILED_LOGIN_ATTEMPTS</span> <span class="token number">3</span> <span class="token keyword">PASSWORD_LOCK_TIME</span> <span class="token number">2</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Lock or unlock an account:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38541838"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ACCOUNT</span> <span class="token keyword">LOCK</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ACCOUNT</span> <span class="token keyword">UNLOCK</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Require an account to connect using SSL and establish
a limit of 20 connections per hour:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69840461"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">SSL</span> <span class="token keyword">WITH</span> <span class="token keyword">MAX_CONNECTIONS_PER_HOUR</span> <span class="token number">20</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Alter multiple accounts, specifying some per-account
properties and some global properties:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93610839"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span>
<span class="token string">'jeffrey'</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">jeffrey_new_password</em>'</span><span class="token punctuation">,</span>
<span class="token string">'jeanne'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span>
<span class="token string">'josh'</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">josh_new_password</em>'</span>
<span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">josh_current_password</em>'</span>
<span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">SSL</span> <span class="token keyword">WITH</span> <span class="token keyword">MAX_USER_CONNECTIONS</span> <span class="token number">2</span>
<span class="token keyword">PASSWORD</span> <span class="token keyword">HISTORY</span> <span class="token number">5</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
IDENTIFIED BY
</code>
value following
<code class="literal">
jeffrey
</code>
applies only to its immediately
preceding account, so it changes the password to
<code class="literal">
'
<em class="replaceable">
<code>
jeffrey_new_password
</code>
</em>
'
</code>
only for
<code class="literal">
jeffrey
</code>
. For
<code class="literal">
jeanne
</code>
, there is no per-account value (thus
leaving the password unchanged). For
<code class="literal">
josh
</code>
,
<code class="literal">
IDENTIFIED BY
</code>
establishes a new password
(
<code class="literal">
'
<em class="replaceable">
<code>
josh_new_password
</code>
</em>
'
</code>
),
<code class="literal">
REPLACE
</code>
is specified to verify that the
user issuing the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement knows the current password
(
<code class="literal">
'
<em class="replaceable">
<code>
josh_current_password
</code>
</em>
'
</code>
),
and that current password is also retained as the account
secondary password. (As a result,
<code class="literal">
josh
</code>
can
connect with either the primary or secondary password.)
</p>
<p>
The remaining properties apply globally to all accounts named
in the statement, so for both accounts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Connections are required to use SSL.
</p>
</li>
<li class="listitem">
<p>
The account can be used for a maximum of two simultaneous
connections.
</p>
</li>
<li class="listitem">
<p>
Password changes cannot reuse any of the five most recent
passwords.
</p>
</li>
</ul>
</div>
<p>
Example: Discard the secondary password for
<code class="literal">
josh
</code>
, leaving the account with only its
primary password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa54496501"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'josh'</span>@<span class="token string">'localhost'</span> <span class="token keyword">DISCARD</span> <span class="token keyword">OLD</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In the absence of a particular type of option, the account
remains unchanged in that respect. For example, with no
locking option, the locking state of the account is not
changed.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-authentication">
</a>
ALTER USER Authentication Options
</h5>
</div>
</div>
</div>
<p>
An account name may be followed by an
<em class="replaceable">
<code>
auth_option
</code>
</em>
authentication option
that specifies the account authentication plugin, credentials,
or both. It may also include a password-verification clause
that specifies the account current password to be replaced,
and clauses that manage whether an account has a secondary
password.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Clauses for random password generation, password
verification, and secondary passwords apply only to accounts
that use an authentication plugin that stores credentials
internally to MySQL. For accounts that use a plugin that
performs authentication against a credentials system that is
external to MySQL, password management must be handled
externally against that system as well. For more information
about internal credentials storage, see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
names an
authentication plugin. The plugin name can be a quoted
string literal or an unquoted name. Plugin names are
stored in the
<code class="literal">
plugin
</code>
column of the
<code class="literal">
mysql.user
</code>
system table.
</p>
<p>
For
<em class="replaceable">
<code>
auth_option
</code>
</em>
syntax that
does not specify an authentication plugin, the server
assigns the default plugin, determined as described in
<a class="xref" href="pluggable-authentication.html#pluggable-authentication-default-plugin" title="The Default Authentication Plugin">
The Default Authentication Plugin
</a>
.
For descriptions of each plugin, see
<a class="xref" href="authentication-plugins.html" title="8.4.1 Authentication Plugins">
Section 8.4.1, “Authentication Plugins”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Credentials that are stored internally are stored in the
<code class="literal">
mysql.user
</code>
system table. An
<code class="literal">
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
value or
<code class="literal">
RANDOM PASSWORD
</code>
specifies
account credentials, either as a cleartext (unencrypted)
string or hashed in the format expected by the
authentication plugin associated with the account,
respectively:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For syntax that uses
<code class="literal">
BY
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
,
the string is cleartext and is passed to the
authentication plugin for possible hashing. The result
returned by the plugin is stored in the
<code class="literal">
mysql.user
</code>
table. A plugin may use
the value as specified, in which case no hashing
occurs.
</p>
</li>
<li class="listitem">
<p>
For syntax that uses
<code class="literal">
BY RANDOM
PASSWORD
</code>
, MySQL generates a random password
and as cleartext and passes it to the authentication
plugin for possible hashing. The result returned by
the plugin is stored in the
<code class="literal">
mysql.user
</code>
table. A plugin may use
the value as specified, in which case no hashing
occurs.
</p>
<p>
Randomly generated passwords have the characteristics
described in
<a class="xref" href="password-management.html#random-password-generation" title="Random Password Generation">
Random Password Generation
</a>
.
</p>
</li>
<li class="listitem">
<p>
For syntax that uses
<code class="literal">
AS
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
,
the string is assumed to be already in the format the
authentication plugin requires, and is stored as is in
the
<code class="literal">
mysql.user
</code>
table. If a plugin
requires a hashed value, the value must be already
hashed in a format appropriate for the plugin;
otherwise, the value cannot be used by the plugin and
correct authentication of client connections does not
occur.
</p>
<p>
A hashed string can be either a string literal or a
hexadecimal value. The latter corresponds to the type
of value displayed by
<a class="link" href="show-create-user.html" title="15.7.7.13 SHOW CREATE USER Statement">
<code class="literal">
SHOW CREATE
USER
</code>
</a>
for password hashes containing
unprintable characters when the
<a class="link" href="server-system-variables.html#sysvar_print_identified_with_as_hex">
<code class="literal">
print_identified_with_as_hex
</code>
</a>
system variable is enabled.
</p>
</li>
<li class="listitem">
<p>
If an authentication plugin performs no hashing of the
authentication string, the
<code class="literal">
BY
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
and
<code class="literal">
AS
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
clauses have the same effect: The authentication
string is stored as is in the
<code class="literal">
mysql.user
</code>
system table.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The
<code class="literal">
REPLACE
'
<em class="replaceable">
<code>
current_auth_string
</code>
</em>
'
</code>
clause performs password verification. If given:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
REPLACE
</code>
specifies the account
current password to be replaced, as a cleartext
(unencrypted) string.
</p>
</li>
<li class="listitem">
<p>
The clause must be given if password changes for the
account are required to specify the current password,
as verification that the user attempting to make the
change actually knows the current password.
</p>
</li>
<li class="listitem">
<p>
The clause is optional if password changes for the
account may but need not specify the current password.
</p>
</li>
<li class="listitem">
<p>
The statement fails if the clause is given but does
not match the current password, even if the clause is
optional.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REPLACE
</code>
can be specified only when
changing the account password for the current user.
</p>
</li>
</ul>
</div>
<p>
For more information about password verification by
specifying the current password, see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
and
<code class="literal">
DISCARD OLD PASSWORD
</code>
clauses implement
dual-password capability. Both are optional, but if given,
have the following effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
retains an
account current password as its secondary password,
replacing any existing secondary password. The new
password becomes the primary password, but clients can
use the account to connect to the server using either
the primary or secondary password. (Exception: If the
new password specified by the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement is
empty, the secondary password becomes empty as well,
even if
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
is
given.)
</p>
</li>
<li class="listitem">
<p>
If you specify
<code class="literal">
RETAIN CURRENT
PASSWORD
</code>
for an account that has an empty
primary password, the statement fails.
</p>
</li>
<li class="listitem">
<p>
If an account has a secondary password and you change
its primary password without specifying
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
, the
secondary password remains unchanged.
</p>
</li>
<li class="listitem">
<p>
If you change the authentication plugin assigned to
the account, the secondary password is discarded. If
you change the authentication plugin and also specify
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
, the
statement fails.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISCARD OLD PASSWORD
</code>
discards the
secondary password, if one exists. The account retains
only its primary password, and clients can use the
account to connect to the server only with the primary
password.
</p>
</li>
</ul>
</div>
<p>
For more information about use of dual passwords, see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
auth_option
</code>
</em>
syntaxes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED BY
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
' [REPLACE
'
<em class="replaceable">
<code>
current_auth_string
</code>
</em>
'] [RETAIN
CURRENT PASSWORD]
</code>
</p>
<p>
Sets the account authentication plugin to the default
plugin, passes the cleartext
<code class="literal">
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
value to the plugin for possible hashing, and stores the
result in the account row in the
<code class="literal">
mysql.user
</code>
system table.
</p>
<p>
The
<code class="literal">
REPLACE
</code>
clause, if given, specifies
the account current password, as described previously in
this section.
</p>
<p>
The
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
clause, if
given, causes the account current password to be retained
as its secondary password, as described previously in this
section.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED BY RANDOM PASSWORD [REPLACE
'
<em class="replaceable">
<code>
current_auth_string
</code>
</em>
'] [RETAIN
CURRENT PASSWORD]
</code>
</p>
<p>
Sets the account authentication plugin to the default
plugin, generates a random password, passes the cleartext
password value to the plugin for possible hashing, and
stores the result in the account row in the
<code class="literal">
mysql.user
</code>
system table. The statement
also returns the cleartext password in a result set to
make it available to the user or application executing the
statement. For details about the result set and
characteristics of randomly generated passwords, see
<a class="xref" href="password-management.html#random-password-generation" title="Random Password Generation">
Random Password Generation
</a>
.
</p>
<p>
The
<code class="literal">
REPLACE
</code>
clause, if given, specifies
the account current password, as described previously in
this section.
</p>
<p>
The
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
clause, if
given, causes the account current password to be retained
as its secondary password, as described previously in this
section.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED WITH
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
</code>
</p>
<p>
Sets the account authentication plugin to
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
, clears the
credentials to the empty string (the credentials are
associated with the old authentication plugin, not the new
one), and stores the result in the account row in the
<code class="literal">
mysql.user
</code>
system table.
</p>
<p>
In addition, the password is marked expired. The user must
choose a new one when next connecting.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED WITH
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
BY
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
' [REPLACE
'
<em class="replaceable">
<code>
current_auth_string
</code>
</em>
'] [RETAIN
CURRENT PASSWORD]
</code>
</p>
<p>
Sets the account authentication plugin to
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
, passes the
cleartext
<code class="literal">
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
value to the plugin for possible hashing, and stores the
result in the account row in the
<code class="literal">
mysql.user
</code>
system table.
</p>
<p>
The
<code class="literal">
REPLACE
</code>
clause, if given, specifies
the account current password, as described previously in
this section.
</p>
<p>
The
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
clause, if
given, causes the account current password to be retained
as its secondary password, as described previously in this
section.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED WITH
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
BY RANDOM PASSWORD
[REPLACE '
<em class="replaceable">
<code>
current_auth_string
</code>
</em>
']
[RETAIN CURRENT PASSWORD]
</code>
</p>
<p>
Sets the account authentication plugin to
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
, generates a random
password, passes the cleartext password value to the
plugin for possible hashing, and stores the result in the
account row in the
<code class="literal">
mysql.user
</code>
system
table. The statement also returns the cleartext password
in a result set to make it available to the user or
application executing the statement. For details about the
result set and characteristics of randomly generated
passwords, see
<a class="xref" href="password-management.html#random-password-generation" title="Random Password Generation">
Random Password Generation
</a>
.
</p>
<p>
The
<code class="literal">
REPLACE
</code>
clause, if given, specifies
the account current password, as described previously in
this section.
</p>
<p>
The
<code class="literal">
RETAIN CURRENT PASSWORD
</code>
clause, if
given, causes the account current password to be retained
as its secondary password, as described previously in this
section.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED WITH
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
AS
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
</p>
<p>
Sets the account authentication plugin to
<em class="replaceable">
<code>
auth_plugin
</code>
</em>
and stores the
<code class="literal">
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
value as is in the
<code class="literal">
mysql.user
</code>
account
row. If the plugin requires a hashed string, the string is
assumed to be already hashed in the format the plugin
requires.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISCARD OLD PASSWORD
</code>
</p>
<p>
Discards the account secondary password, if there is one,
as described previously in this section.
</p>
</li>
</ul>
</div>
<p>
Example: Specify the password as cleartext; the default plugin
is used:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92526037"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</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></code></pre>
</div>
<p>
Example: Specify the authentication plugin, along with a
cleartext password value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56254447"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> mysql_native_password
<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>
Example: Like the preceding example, but in addition, specify
the current password as a cleartext value to satisfy any
account requirement that the user making the change knows that
password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23174469"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> mysql_native_password
<span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token keyword">REPLACE</span> <span class="token string">'<em class="replaceable">current_password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The preceding statement fails unless the current user is
<code class="literal">
jeffrey
</code>
because
<code class="literal">
REPLACE
</code>
is permitted only for changes to the current user's password.
</p>
<p>
Example: Establish a new primary password and retain the
existing password as the secondary password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63387490"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</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">new_password</em>'</span>
<span class="token keyword">RETAIN</span> <span class="token keyword">CURRENT</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Discard the secondary password, leaving the account
with only its primary password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa13862416"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffery'</span>@<span class="token string">'localhost'</span> <span class="token keyword">DISCARD</span> <span class="token keyword">OLD</span> <span class="token keyword">PASSWORD</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Example: Specify the authentication plugin, along with a
hashed password value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9170099"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> mysql_native_password
<span class="token keyword">AS</span> <span class="token string">'*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For additional information about setting passwords and
authentication plugins, see
<a class="xref" href="assigning-passwords.html" title="8.2.14 Assigning Account Passwords">
Section 8.2.14, “Assigning Account Passwords”
</a>
, and
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-multifactor-authentication">
</a>
ALTER USER Multifactor Authentication Options
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
has
<code class="literal">
ADD
</code>
,
<code class="literal">
MODIFY
</code>
, and
<code class="literal">
DROP
</code>
clauses that enable authentication
factors to be added, modified, or dropped. In each case, the
clause specifies an operation to perform on one authentication
factor, and optionally an operation on another authentication
factor. For each operation, the
<em class="replaceable">
<code>
factor
</code>
</em>
item specifies the
<code class="literal">
FACTOR
</code>
keyword preceded by the number 2 or
3 to indicate whether the operation applies to the second or
third authentication factor. (1 is not permitted in this
context. To act on the first authentication factor, use the
syntax described in
<a class="xref" href="alter-user.html#alter-user-authentication" title="ALTER USER Authentication Options">
ALTER USER Authentication Options
</a>
.)
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
multifactor
authentication clause constraints are defined by the
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
system
variable. For example, the
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
setting
controls the number of authentication factors that accounts
may have, and for each factor, which authentication methods
are permitted. See
<a class="xref" href="multifactor-authentication.html#multifactor-authentication-policy" title="Configuring the Multifactor Authentication Policy">
Configuring the Multifactor Authentication Policy
</a>
.
</p>
<p>
When
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
adds, modifies,
or drops second and third factors in a single statement,
operations are executed sequentially, but if any operation in
the sequence fails the entire
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER
</code>
</a>
statement fails.
</p>
<p>
For
<code class="literal">
ADD
</code>
, each named factor must not already
exist or it cannot be added. For
<code class="literal">
MODIFY
</code>
and
<code class="literal">
DROP
</code>
, each named factor must exist to be
modified or dropped. If a second and third factor are defined,
dropping the second factor causes the third factor to take its
place as the second factor.
</p>
<p>
This statement drops authentication factors 2 and 3, which has
the effect of converting the account from 3FA to 1FA:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa26974052"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'<em class="replaceable">user</em>'</span> <span class="token keyword">DROP</span> <span class="token number">2</span> FACTOR <span class="token number">3</span> FACTOR<span class="token punctuation">;</span></code></pre>
</div>
<p>
For additional
<code class="literal">
ADD
</code>
,
<code class="literal">
MODIFY
</code>
, and
<code class="literal">
DROP
</code>
examples, see
<a class="xref" href="multifactor-authentication.html#multifactor-authentication-getting-started" title="Getting Started with Multifactor Authentication">
Getting Started with Multifactor Authentication
</a>
.
</p>
<p>
For information about factor-specific rules that determine the
default authentication plugin for authentication clauses that
do not name a plugin, see
<a class="xref" href="pluggable-authentication.html#pluggable-authentication-default-plugin" title="The Default Authentication Plugin">
The Default Authentication Plugin
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-registration-">
</a>
ALTER USER Registration Options
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
has clauses that
enable FIDO/FIDO2 devices to be registered and unregistered.
For more information, see
<a class="xref" href="webauthn-pluggable-authentication.html#webauthn-pluggable-authentication-usage" title="Using WebAuthn Authentication">
Using WebAuthn Authentication
</a>
,
<a class="xref" href="webauthn-pluggable-authentication.html#webauthn-pluggable-authentication-unregistration" title="Device Unregistration for WebAuthn">
Device Unregistration for WebAuthn
</a>
,
and 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 class="link" href="mysql-command-options.html#option_mysql_register-factor">
<code class="option">
--register-factor
</code>
</a>
option
description.
</p>
<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>
client
<a class="link" href="mysql-command-options.html#option_mysql_register-factor">
<code class="option">
--register-factor
</code>
</a>
option, used
for FIDO/FIDO2 device registration, causes 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 to generate and execute
<code class="literal">
INITIATE REGISTRATION
</code>
and
<code class="literal">
FINISH
REGISTRATION
</code>
statements. These statements are not
intended for manual execution.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-role">
</a>
ALTER USER Role Options
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174873184">
</a>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER ...
DEFAULT ROLE
</code>
</a>
defines which roles become active when
the user connects to the server and authenticates, or when the
user executes the
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
DEFAULT
</code>
</a>
statement during a session.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER ...
DEFAULT ROLE
</code>
</a>
is alternative syntax for
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
(see
<a class="xref" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
Section 15.7.1.9, “SET DEFAULT ROLE Statement”
</a>
). However,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
can set the default
for only a single user, whereas
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET
DEFAULT ROLE
</code>
</a>
can set the default for multiple users.
On the other hand, you can specify
<code class="literal">
CURRENT_USER
</code>
as the user name for the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement, whereas
you cannot for
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT
ROLE
</code>
</a>
.
</p>
<p>
Each user account name uses the format described previously.
</p>
<p>
Each role name uses the format described in
<a class="xref" href="role-names.html" title="8.2.5 Specifying Role Names">
Section 8.2.5, “Specifying Role Names”
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78042097"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'joe'</span>@<span class="token string">'10.0.0.1'</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">ROLE</span> administrator<span class="token punctuation">,</span> developer<span class="token punctuation">;</span></code></pre>
</div>
<p>
The host name part of the role name, if omitted, defaults to
<code class="literal">
'%'
</code>
.
</p>
<p>
The clause following the
<code class="literal">
DEFAULT ROLE
</code>
keywords permits these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NONE
</code>
: Set the default to
<code class="literal">
NONE
</code>
(no roles).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ALL
</code>
: Set the default to all roles
granted to the account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
role
</code>
</em>
[,
<em class="replaceable">
<code>
role
</code>
</em>
] ...
</code>
: Set the
default to the named roles, which must exist and be
granted to the account at the time
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER ...
DEFAULT ROLE
</code>
</a>
is executed.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-tls">
</a>
ALTER USER SSL/TLS Options
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174845264">
</a>
<a class="indexterm" name="idm46045174843808">
</a>
<a class="indexterm" name="idm46045174842320">
</a>
<p>
MySQL can check X.509 certificate attributes in addition to
the usual authentication that is based on the user name and
credentials. For background information on the use of SSL/TLS
with MySQL, see
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
.
</p>
<p>
To specify SSL/TLS-related options for a MySQL account, use a
<code class="literal">
REQUIRE
</code>
clause that specifies one or more
<em class="replaceable">
<code>
tls_option
</code>
</em>
values.
</p>
<p>
Order of
<code class="literal">
REQUIRE
</code>
options does not matter,
but no option can be specified twice. The
<code class="literal">
AND
</code>
keyword is optional between
<code class="literal">
REQUIRE
</code>
options.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
tls_option
</code>
</em>
values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NONE
</code>
</p>
<p>
Indicates that all accounts named by the statement have no
SSL or X.509 requirements. Unencrypted connections are
permitted if the user name and password are valid.
Encrypted connections can be used, at the client's option,
if the client has the proper certificate and key files.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa57108356"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Clients attempt to establish a secure connection by
default. For clients that have
<code class="literal">
REQUIRE
NONE
</code>
, the connection attempt falls back to an
unencrypted connection if a secure connection cannot be
established. To require an encrypted connection, a client
need specify only the
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=REQUIRED
</code>
</a>
option; the connection attempt fails if a secure
connection cannot be established.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SSL
</code>
</p>
<p>
Tells the server to permit only encrypted connections for
all accounts named by the statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa96493503"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">SSL</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Clients attempt to establish a secure connection by
default. For accounts that have
<code class="literal">
REQUIRE
SSL
</code>
, the connection attempt fails if a secure
connection cannot be established.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
X509
</code>
</p>
<p>
For all accounts named by the statement, requires that
clients present a valid certificate, but the exact
certificate, issuer, and subject do not matter. The only
requirement is that it should be possible to verify its
signature with one of the CA certificates. Use of X.509
certificates always implies encryption, so the
<code class="literal">
SSL
</code>
option is unnecessary in this case.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa41000606"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">X509</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For accounts with
<code class="literal">
REQUIRE X509
</code>
, clients
must specify the
<a class="link" href="connection-options.html#option_general_ssl-key">
<code class="option">
--ssl-key
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-cert">
<code class="option">
--ssl-cert
</code>
</a>
options to
connect. (It is recommended but not required that
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
also be specified
so that the public certificate provided by the server can
be verified.) This is true for
<code class="literal">
ISSUER
</code>
and
<code class="literal">
SUBJECT
</code>
as well because those
<code class="literal">
REQUIRE
</code>
options imply the requirements
of
<code class="literal">
X509
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ISSUER
'
<em class="replaceable">
<code>
issuer
</code>
</em>
'
</code>
</p>
<p>
For all accounts named by the statement, requires that
clients present a valid X.509 certificate issued by CA
<code class="literal">
'
<em class="replaceable">
<code>
issuer
</code>
</em>
'
</code>
. If
a client presents a certificate that is valid but has a
different issuer, the server rejects the connection. Use
of X.509 certificates always implies encryption, so the
<code class="literal">
SSL
</code>
option is unnecessary in this case.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33925901"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">ISSUER</span> <span class="token string">'/C=SE/ST=Stockholm/L=Stockholm/
O=MySQL/CN=CA/emailAddress=ca@example.com'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Because
<code class="literal">
ISSUER
</code>
implies the requirements
of
<code class="literal">
X509
</code>
, clients must specify the
<a class="link" href="connection-options.html#option_general_ssl-key">
<code class="option">
--ssl-key
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-cert">
<code class="option">
--ssl-cert
</code>
</a>
options to
connect. (It is recommended but not required that
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
also be specified
so that the public certificate provided by the server can
be verified.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SUBJECT
'
<em class="replaceable">
<code>
subject
</code>
</em>
'
</code>
</p>
<p>
For all accounts named by the statement, requires that
clients present a valid X.509 certificate containing the
subject
<em class="replaceable">
<code>
subject
</code>
</em>
. If a client
presents a certificate that is valid but has a different
subject, the server rejects the connection. Use of X.509
certificates always implies encryption, so the
<code class="literal">
SSL
</code>
option is unnecessary in this case.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99408873"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">SUBJECT</span> <span class="token string">'/C=SE/ST=Stockholm/L=Stockholm/
O=MySQL demo client certificate/
CN=client/emailAddress=client@example.com'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL does a simple string comparison of the
<code class="literal">
'
<em class="replaceable">
<code>
subject
</code>
</em>
'
</code>
value to the value in the certificate, so lettercase and
component ordering must be given exactly as present in the
certificate.
</p>
<p>
Because
<code class="literal">
SUBJECT
</code>
implies the
requirements of
<code class="literal">
X509
</code>
, clients must
specify the
<a class="link" href="connection-options.html#option_general_ssl-key">
<code class="option">
--ssl-key
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-cert">
<code class="option">
--ssl-cert
</code>
</a>
options to
connect. (It is recommended but not required that
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
also be specified
so that the public certificate provided by the server can
be verified.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CIPHER
'
<em class="replaceable">
<code>
cipher
</code>
</em>
'
</code>
</p>
<p>
For all accounts named by the statement, requires a
specific cipher method for encrypting connections. This
option is needed to ensure that ciphers and key lengths of
sufficient strength are used. Encryption can be weak if
old algorithms using short encryption keys are used.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16431891"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">CIPHER</span> <span class="token string">'EDH-RSA-DES-CBC3-SHA'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The
<code class="literal">
SUBJECT
</code>
,
<code class="literal">
ISSUER
</code>
, and
<code class="literal">
CIPHER
</code>
options can be combined in the
<code class="literal">
REQUIRE
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98185184"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">REQUIRE</span> <span class="token keyword">SUBJECT</span> <span class="token string">'/C=SE/ST=Stockholm/L=Stockholm/
O=MySQL demo client certificate/
CN=client/emailAddress=client@example.com'</span>
<span class="token operator">AND</span> <span class="token keyword">ISSUER</span> <span class="token string">'/C=SE/ST=Stockholm/L=Stockholm/
O=MySQL/CN=CA/emailAddress=ca@example.com'</span>
<span class="token operator">AND</span> <span class="token keyword">CIPHER</span> <span class="token string">'EDH-RSA-DES-CBC3-SHA'</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="alter-user-resource-limits">
</a>
ALTER USER Resource-Limit Options
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174780048">
</a>
<a class="indexterm" name="idm46045174778560">
</a>
<p>
It is possible to place limits on use of server resources by
an account, as discussed in
<a class="xref" href="user-resources.html" title="8.2.21 Setting Account Resource Limits">
Section 8.2.21, “Setting Account Resource Limits”
</a>
.
To do so, use a
<code class="literal">
WITH
</code>
clause that specifies
one or more
<em class="replaceable">
<code>
resource_option
</code>
</em>
values.
</p>
<p>
Order of
<code class="literal">
WITH
</code>
options does not matter,
except that if a given resource limit is specified multiple
times, the last instance takes precedence.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
resource_option
</code>
</em>
values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
MAX_QUERIES_PER_HOUR
<em class="replaceable">
<code>
count
</code>
</em>
</code>
,
<code class="literal">
MAX_UPDATES_PER_HOUR
<em class="replaceable">
<code>
count
</code>
</em>
</code>
,
<code class="literal">
MAX_CONNECTIONS_PER_HOUR
<em class="replaceable">
<code>
count
</code>
</em>
</code>
</p>
<p>
For all accounts named by the statement, these options
restrict how many queries, updates, and connections to the
server are permitted to each account during any given
one-hour period. If
<em class="replaceable">
<code>
count
</code>
</em>
is
<code class="literal">
0
</code>
(the default), this means that there
is no limitation for the account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MAX_USER_CONNECTIONS
<em class="replaceable">
<code>
count
</code>
</em>
</code>
</p>
<p>
For all accounts named by the statement, restricts the
maximum number of simultaneous connections to the server
by each account. A nonzero
<em class="replaceable">
<code>
count
</code>
</em>
specifies the limit for
the account explicitly. If
<em class="replaceable">
<code>
count
</code>
</em>
is
<code class="literal">
0
</code>
(the default), the server determines the number of
simultaneous connections for the account from the global
value of the
<a class="link" href="server-system-variables.html#sysvar_max_user_connections">
<code class="literal">
max_user_connections
</code>
</a>
system variable. If
<a class="link" href="server-system-variables.html#sysvar_max_user_connections">
<code class="literal">
max_user_connections
</code>
</a>
is
also zero, there is no limit for the account.
</p>
</li>
</ul>
</div>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48641154"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">WITH</span> <span class="token keyword">MAX_QUERIES_PER_HOUR</span> <span class="token number">500</span> <span class="token keyword">MAX_UPDATES_PER_HOUR</span> <span class="token number">100</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="alter-user-password-management">
</a>
ALTER USER Password-Management Options
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
supports several
<em class="replaceable">
<code>
password_option
</code>
</em>
values for password
management:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Password expiration options: You can expire an account
password manually and establish its password expiration
policy. Policy options do not expire the password.
Instead, they determine how the server applies automatic
expiration to the account based on password age, which is
assessed from the date and time of the most recent account
password change.
</p>
</li>
<li class="listitem">
<p>
Password reuse options: You can restrict password reuse
based on number of password changes, time elapsed, or
both.
</p>
</li>
<li class="listitem">
<p>
Password verification-required options: You can indicate
whether attempts to change an account password must
specify the current password, as verification that the
user attempting to make the change actually knows the
current password.
</p>
</li>
<li class="listitem">
<p>
Incorrect-password failed-login tracking options: You can
cause the server to track failed login attempts and
temporarily lock accounts for which too many consecutive
incorrect passwords are given. The required number of
failures and the lock time are configurable.
</p>
</li>
</ul>
</div>
<p>
This section describes the syntax for password-management
options. For information about establishing policy for
password management, see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
<p>
If multiple password-management options of a given type are
specified, the last one takes precedence. For example,
<code class="literal">
PASSWORD EXPIRE DEFAULT PASSWORD EXPIRE
NEVER
</code>
is the same as
<code class="literal">
PASSWORD EXPIRE
NEVER
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Except for the options that pertain to failed-login
tracking, password-management options apply only to accounts
that use an authentication plugin that stores credentials
internally to MySQL. For accounts that use a plugin that
performs authentication against a credentials system that is
external to MySQL, password management must be handled
externally against that system as well. For more information
about internal credentials storage, see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</div>
<p>
A client has an expired password if the account password was
expired manually or the password age is considered greater
than its permitted lifetime per the automatic expiration
policy. In this case, the server either disconnects the client
or restricts the operations permitted to it (see
<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>
). Operations
performed by a restricted client result in an error until the
user establishes a new account password.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Although it is possible to
<span class="quote">
“
<span class="quote">
reset
</span>
”
</span>
an expired
password by setting it to its current value, it is
preferable, as a matter of good policy, to choose a
different password. DBAs can enforce non-reuse by
establishing an appropriate password-reuse policy. See
<a class="xref" href="password-management.html#password-reuse-policy" title="Password Reuse Policy">
Password Reuse Policy
</a>
.
</p>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
password_option
</code>
</em>
values for
controlling password expiration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
PASSWORD EXPIRE
</code>
</p>
<p>
Immediately marks the password expired for all accounts
named by the statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa49410916"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD EXPIRE DEFAULT
</code>
</p>
<p>
Sets all accounts named by the statement so that the
global expiration policy applies, as specified by the
<a class="link" href="server-system-variables.html#sysvar_default_password_lifetime">
<code class="literal">
default_password_lifetime
</code>
</a>
system variable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa93400001"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD EXPIRE NEVER
</code>
</p>
<p>
This expiration option overrides the global policy for all
accounts named by the statement. For each, it disables
password expiration so that the password never expires.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67479292"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span> <span class="token keyword">NEVER</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD EXPIRE INTERVAL
<em class="replaceable">
<code>
N
</code>
</em>
DAY
</code>
</p>
<p>
This expiration option overrides the global policy for all
accounts named by the statement. For each, it sets the
password lifetime to
<em class="replaceable">
<code>
N
</code>
</em>
days.
The following statement requires the password to be
changed every 180 days:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61811744"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span> <span class="token keyword">INTERVAL</span> <span class="token number">180</span> <span class="token keyword">DAY</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
password_option
</code>
</em>
values for
controlling reuse of previous passwords based on required
minimum number of password changes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
PASSWORD HISTORY DEFAULT
</code>
</p>
<p>
Sets all accounts named by the statement so that the
global policy about password history length applies, to
prohibit reuse of passwords before the number of changes
specified by the
<a class="link" href="server-system-variables.html#sysvar_password_history">
<code class="literal">
password_history
</code>
</a>
system
variable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa22732652"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">HISTORY</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD HISTORY
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</p>
<p>
This history-length option overrides the global policy for
all accounts named by the statement. For each, it sets the
password history length to
<em class="replaceable">
<code>
N
</code>
</em>
passwords, to prohibit reusing any of the
<em class="replaceable">
<code>
N
</code>
</em>
most recently chosen
passwords. The following statement prohibits reuse of any
of the previous 6 passwords:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa55828753"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">HISTORY</span> <span class="token number">6</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
password_option
</code>
</em>
values for
controlling reuse of previous passwords based on time elapsed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
PASSWORD REUSE INTERVAL DEFAULT
</code>
</p>
<p>
Sets all statements named by the account so that the
global policy about time elapsed applies, to prohibit
reuse of passwords newer than the number of days specified
by the
<a class="link" href="server-system-variables.html#sysvar_password_reuse_interval">
<code class="literal">
password_reuse_interval
</code>
</a>
system variable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa54920998"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REUSE</span> <span class="token keyword">INTERVAL</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD REUSE INTERVAL
<em class="replaceable">
<code>
N
</code>
</em>
DAY
</code>
</p>
<p>
This time-elapsed option overrides the global policy for
all accounts named by the statement. For each, it sets the
password reuse interval to
<em class="replaceable">
<code>
N
</code>
</em>
days, to prohibit reuse of passwords newer than that many
days. The following statement prohibits password reuse for
360 days:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87239801"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REUSE</span> <span class="token keyword">INTERVAL</span> <span class="token number">360</span> <span class="token keyword">DAY</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
password_option
</code>
</em>
values for
controlling whether attempts to change an account password
must specify the current password, as verification that the
user attempting to make the change actually knows the current
password:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
PASSWORD REQUIRE CURRENT
</code>
</p>
<p>
This verification option overrides the global policy for
all accounts named by the statement. For each, it requires
that password changes specify the current password.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa86323638"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">CURRENT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD REQUIRE CURRENT OPTIONAL
</code>
</p>
<p>
This verification option overrides the global policy for
all accounts named by the statement. For each, it does not
require that password changes specify the current
password. (The current password may but need not be
given.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45689100"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">CURRENT</span> <span class="token keyword">OPTIONAL</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD REQUIRE CURRENT DEFAULT
</code>
</p>
<p>
Sets all statements named by the account so that the
global policy about password verification applies, as
specified by the
<a class="link" href="server-system-variables.html#sysvar_password_require_current">
<code class="literal">
password_require_current
</code>
</a>
system variable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88097517"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">REQUIRE</span> <span class="token keyword">CURRENT</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
permits these
<em class="replaceable">
<code>
password_option
</code>
</em>
values for
controlling failed-login tracking:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
FAILED_LOGIN_ATTEMPTS
<em class="replaceable">
<code>
N
</code>
</em>
</code>
</p>
<p>
Whether to track account login attempts that specify an
incorrect password.
<em class="replaceable">
<code>
N
</code>
</em>
must be a
number from 0 to 32767. A value of 0 disables failed-login
tracking. Values greater than 0 indicate how many
consecutive password failures cause temporary account
locking (if
<code class="literal">
PASSWORD_LOCK_TIME
</code>
is also
nonzero).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PASSWORD_LOCK_TIME {
<em class="replaceable">
<code>
N
</code>
</em>
| UNBOUNDED}
</code>
</p>
<p>
How long to lock the account after too many consecutive
login attempts provide an incorrect password.
<em class="replaceable">
<code>
N
</code>
</em>
must be a number from 0 to
32767, or
<code class="literal">
UNBOUNDED
</code>
. A value of 0
disables temporary account locking. Values greater than 0
indicate how long to lock the account in days. A value of
<code class="literal">
UNBOUNDED
</code>
causes the account locking
duration to be unbounded; once locked, the account remains
in a locked state until unlocked. For information about
the conditions under which unlocking occurs, see
<a class="xref" href="password-management.html#failed-login-tracking" title="Failed-Login Tracking and Temporary Account Locking">
Failed-Login Tracking and Temporary Account Locking
</a>
.
</p>
</li>
</ul>
</div>
<p>
For failed-login tracking and temporary locking to occur, an
account's
<code class="literal">
FAILED_LOGIN_ATTEMPTS
</code>
and
<code class="literal">
PASSWORD_LOCK_TIME
</code>
options both must be
nonzero. The following statement modifies an account such that
it remains locked for two days after four consecutive password
failures:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25796352"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">FAILED_LOGIN_ATTEMPTS</span> <span class="token number">4</span> <span class="token keyword">PASSWORD_LOCK_TIME</span> <span class="token number">2</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="alter-user-comments-attributes">
</a>
ALTER USER Comment and Attribute Options
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174671568">
</a>
<a class="indexterm" name="idm46045174670080">
</a>
<p>
MySQL 8.4 supports user comments and user
attributes, as described in
<a class="xref" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
Section 15.7.1.3, “CREATE USER Statement”
</a>
.
These can be modified employing
<code class="literal">
ALTER USER
</code>
by means of the
<code class="literal">
COMMENT
</code>
and
<code class="literal">
ATTRIBUTE
</code>
options, respectively. You cannot
specify both options in the same
<code class="literal">
ALTER USER
</code>
statement; attempting to do so results in a syntax error.
</p>
<p>
The user comment and user attribute are stored in the
Information Schema
<a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
<code class="literal">
USER_ATTRIBUTES
</code>
</a>
table as a JSON
object; the user comment is stored as the value for a
<code class="literal">
comment
</code>
key in the ATTRIBUTE column of this
table, as shown later in this discussion. The
<code class="literal">
COMMENT
</code>
text can be any arbitrary quoted
text, and replaces any existing user comment. The
<code class="literal">
ATTRIBUTE
</code>
value must be the valid string
representation of a JSON object. This is merged with any
existing user attribute as if the
<a class="link" href="json-modification-functions.html#function_json-merge-patch">
<code class="literal">
JSON_MERGE_PATCH()
</code>
</a>
function had
been used on the existing user attribute and the new one; for
any keys that are re-used, the new value overwrites the old
one, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84092051"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"foo": "bar"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.11 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'bill'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ATTRIBUTE</span> <span class="token string">'{"baz": "faz", "foo": "moo"}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.22 sec)</span>
<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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"baz": "faz", "foo": "moo"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
To remove a key and its value from the user attribute, set the
key to JSON
<code class="literal">
null
</code>
(must be lowercase and
unquoted), like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48709285"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'bill'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ATTRIBUTE</span> <span class="token string">'{"foo": null}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.08 sec)</span>
<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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"baz": "faz"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
To set an existing user comment to an empty string, use
<code class="literal">
ALTER USER ... COMMENT ''
</code>
. This leaves an
empty
<code class="literal">
comment
</code>
value in the
<a class="link" href="information-schema-user-attributes-table.html" title="28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table">
<code class="literal">
USER_ATTRIBUTES
</code>
</a>
table; to remove
the user comment completely, use
<code class="literal">
ALTER USER ...
ATTRIBUTE ...
</code>
with the value for the column key set
to JSON
<code class="literal">
null
</code>
(unquoted, in lower case).
This is illustrated by the following sequence of SQL
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99499874"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USER</span> <span class="token string">'bill'</span>@<span class="token string">'localhost'</span> <span class="token keyword">COMMENT</span> <span class="token string">'Something about Bill'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.06 sec)</span>
<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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"baz": "faz", "comment": "Something about Bill"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'bill'</span>@<span class="token string">'localhost'</span> <span class="token keyword">COMMENT</span> <span class="token string">''</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.09 sec)</span>
<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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"baz": "faz", "comment": ""} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'bill'</span>@<span class="token string">'localhost'</span> <span class="token keyword">ATTRIBUTE</span> <span class="token string">'{"comment": null}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.07 sec)</span>
<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>USER_ATTRIBUTES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">USER</span><span class="token operator">=</span><span class="token string">'bill'</span> <span class="token operator">AND</span> <span class="token keyword">HOST</span><span class="token operator">=</span><span class="token string">'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>
<span class="token output"><span class="token punctuation">|</span> USER <span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> ATTRIBUTE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> bill <span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> {"baz": "faz"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-account-locking">
</a>
ALTER USER Account-Locking Options
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174632752">
</a>
<p>
MySQL supports account locking and unlocking using the
<code class="literal">
ACCOUNT LOCK
</code>
and
<code class="literal">
ACCOUNT
UNLOCK
</code>
options, which specify the locking state for
an account. For additional discussion, see
<a class="xref" href="account-locking.html" title="8.2.20 Account Locking">
Section 8.2.20, “Account Locking”
</a>
.
</p>
<p>
If multiple account-locking options are specified, the last
one takes precedence.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER ...
ACCOUNT UNLOCK
</code>
</a>
unlocks any account named by the
statement that is temporarily locked due to too many failed
logins. See
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="alter-user-binary-logging">
</a>
ALTER USER Binary Logging
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045174624352">
</a>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
is written to the
binary log if it succeeds, but not if it fails; in that case,
rollback occurs and no changes are made. A statement written
to the binary log includes all named users. If the
<code class="literal">
IF
EXISTS
</code>
clause is given, this includes even users
that do not exist and were not altered.
</p>
<p>
If the original statement changes the credentials for a user,
the statement written to the binary log specifies the
applicable authentication plugin for that user, determined as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The plugin named in the original statement, if one was
specified.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the plugin associated with the user account if
the user exists, or the default authentication plugin if
the user does not exist. (If the statement written to the
binary log must specify a particular authentication plugin
for a user, include it in the original statement.)
</p>
</li>
</ul>
</div>
<p>
If the server adds the default authentication plugin for any
users in the statement written to the binary log, it writes a
warning to the error log naming those users.
</p>
<p>
If the original statement specifies the
<code class="literal">
FAILED_LOGIN_ATTEMPTS
</code>
or
<code class="literal">
PASSWORD_LOCK_TIME
</code>
option, the statement
written to the binary log includes the option.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statements with
clauses that support multifactor authentication (MFA) are
written to the binary log with the exception of
<code class="literal">
ALTER
USER
<em class="replaceable">
<code>
user factor
</code>
</em>
INITIATE
REGISTRATION
</code>
statements.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ALTER USER
<em class="replaceable">
<code>
user factor
</code>
</em>
FINISH REGISTRATION SET CHALLENGE_RESPONSE AS
'
<em class="replaceable">
<code>
auth_string
</code>
</em>
'
</code>
statements are written to the binary log as
<code class="literal">
ALTER
USER
<em class="replaceable">
<code>
user
</code>
</em>
MODIFY
<em class="replaceable">
<code>
factor
</code>
</em>
IDENTIFIED WITH
authentication_webauthn AS
<em class="replaceable">
<code>
webauthn_hash_string
</code>
</em>
</code>
;
</p>
</li>
<li class="listitem">
<p>
In a replication context, the replication user requires
<a class="link" href="privileges-provided.html#priv_passwordless-user-admin">
<code class="literal">
PASSWORDLESS_USER_ADMIN
</code>
</a>
privilege to execute
<code class="literal">
ALTER USER ...
MODIFY
</code>
operations on accounts configured for
passwordless authentication using the
<code class="literal">
authentication_webauthn
</code>
plugin.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/trigger-metadata.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="trigger-metadata">
</a>
27.3.2 Trigger Metadata
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045082279760">
</a>
<a class="indexterm" name="idm46045082278272">
</a>
<p>
To obtain metadata about triggers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Query the
<a class="link" href="information-schema-triggers-table.html" title="28.3.44 The INFORMATION_SCHEMA TRIGGERS Table">
<code class="literal">
TRIGGERS
</code>
</a>
table of the
<code class="literal">
INFORMATION_SCHEMA
</code>
database. See
<a class="xref" href="information-schema-triggers-table.html" title="28.3.44 The INFORMATION_SCHEMA TRIGGERS Table">
Section 28.3.44, “The INFORMATION_SCHEMA TRIGGERS Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use the
<a class="link" href="show-create-trigger.html" title="15.7.7.12 SHOW CREATE TRIGGER Statement">
<code class="literal">
SHOW CREATE TRIGGER
</code>
</a>
statement. See
<a class="xref" href="show-create-trigger.html" title="15.7.7.12 SHOW CREATE TRIGGER Statement">
Section 15.7.7.12, “SHOW CREATE TRIGGER Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use the
<a class="link" href="show-triggers.html" title="15.7.7.40 SHOW TRIGGERS Statement">
<code class="literal">
SHOW TRIGGERS
</code>
</a>
statement. See
<a class="xref" href="show-triggers.html" title="15.7.7.40 SHOW TRIGGERS Statement">
Section 15.7.7.40, “SHOW TRIGGERS Statement”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-distributed-recovery-fault.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-distributed-recovery-fault">
</a>
20.5.4.4 Fault Tolerance for Distributed Recovery
</h4>
</div>
</div>
</div>
<p>
Group Replication's distributed recovery process has a number of
built-in measures to ensure fault tolerance in the event of any
problems during the process.
</p>
<p>
The donor for distributed recovery is selected randomly from the
existing list of suitable online group members in the current
view. Selecting a random donor means that there is a good chance
that the same server is not selected more than once when
multiple members enter the group. For state transfer from the
binary log, the joiner selects a donor that is running a lower
or equal patch version of MySQL Server compared to itself. For
earlier releases, all of the online members are allowed to be a
donor. For a remote cloning operation, the joiner selects a
donor that is running the same patch version as itself. When the
member joining has restarted at the end of the operation, it
establishes a connection with a new donor for state transfer
from the binary log, which might be a different member from the
original donor used for the remote cloning operation.
</p>
<p>
In the following situations, Group Replication detects an error
in distributed recovery, automatically switches over to a new
donor, and retries the state transfer:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Connection error
</em>
</span>
- There is an
authentication issue or another problem with making the
connection to a candidate donor.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Replication errors
</em>
</span>
- One of the
replication threads (the receiver or applier threads) being
used for state transfer from the binary log fails. Because
this method of state transfer uses the existing MySQL
replication framework, it is possible that some transient
errors could cause errors in the receiver or applier
threads.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Remote cloning operation errors
</em>
</span>
- A
remote cloning operation fails or is stopped before it
completes.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Donor leaves the group
</em>
</span>
- The donor
leaves the group, or Group Replication is stopped on the
donor, while state transfer is in progress.
</p>
</li>
</ul>
</div>
<p>
The Performance Schema table
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
displays the error that caused the last retry. In these
situations, the new connection following the error is attempted
with a new candidate donor. Selecting a different donor in the
event of an error means that there is a chance the new candidate
donor does not have the same error. If the clone plugin is
installed, Group Replication attempts a remote cloning operation
with each of the suitable online clone-supporting donors first.
If all those attempts fail, Group Replication attempts state
transfer from the binary log with all the suitable donors in
turn, if that is possible.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
For a remote cloning operation, user-created tablespaces and
data on the recipient (the joining member) are dropped before
the remote cloning operation begins to transfer the data from
the donor. If the remote cloning operation starts but does not
complete, the joining member might be left with a partial set
of its original data files, or with no user data. Data
transferred by the donor is removed from the recipient if the
cloning operation is stopped before the data is fully cloned.
This situation can be repaired by retrying the cloning
operation, which Group Replication does automatically.
</p>
</div>
<p>
In the following situations, the distributed recovery process
cannot be completed, and the joining member leaves the group:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Purged transactions
</em>
</span>
- Transactions that
are required by the joining member are not present in any
online group member's binary log files, and the data cannot
be obtained by a remote cloning operation (because the clone
plugin is not installed, or because cloning was attempted
with all possible donors but failed). The joining member is
therefore unable to catch up with the group.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Extra transactions
</em>
</span>
- The joining member
already contains some transactions that are not present in
the group. If a remote cloning operation was carried out,
these transactions would be deleted and lost, because the
data directory on the joining member is erased. If state
transfer from a donor's binary log was carried out, these
transactions could conflict with the group's transactions.
For advice on dealing with this situation, see
<a class="xref" href="group-replication-gtids.html#group-replication-gtids-extra" title="Extra Transactions">
Extra Transactions
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Connection retry limit reached
</em>
</span>
- The
joining member has made all the connection attempts allowed
by the connection retry limit. You can configure this using
the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_retry_count">
<code class="literal">
group_replication_recovery_retry_count
</code>
</a>
system variable (see
<a class="xref" href="group-replication-tuning-recovery.html" title="20.5.4.3 Configuring Distributed Recovery">
Section 20.5.4.3, “Configuring Distributed Recovery”
</a>
).
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
No more donors
</em>
</span>
- The joining member has
unsuccessfully attempted a remote cloning operation with
each of the online clone-supporting donors in turn (if the
clone plugin is installed), then has unsuccessfully
attempted state transfer from the binary log with each of
the suitable online donors in turn, if possible.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Joining member leaves the group
</em>
</span>
- The
joining member leaves the group or Group Replication is
stopped on the joining member while state transfer is in
progress.
</p>
</li>
</ul>
</div>
<p>
If the joining member left the group unintentionally, so in any
situation listed above except the last, it proceeds to take the
action specified by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_exit_state_action">
<code class="literal">
group_replication_exit_state_action
</code>
</a>
system variable.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-secure-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-secure-installation">
</a>
6.4.2 mysql_secure_installation — Improve MySQL Installation Security
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045320634576">
</a>
<p>
This program enables you to improve the security of your MySQL
installation in the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You can set a password for
<code class="literal">
root
</code>
accounts.
</p>
</li>
<li class="listitem">
<p>
You can remove
<code class="literal">
root
</code>
accounts that are
accessible from outside the local host.
</p>
</li>
<li class="listitem">
<p>
You can remove anonymous-user accounts.
</p>
</li>
<li class="listitem">
<p>
You can remove the
<code class="literal">
test
</code>
database (which
by default can be accessed by all users, even anonymous
users), and privileges that permit anyone to access
databases with names that start with
<code class="literal">
test_
</code>
.
</p>
</li>
</ul>
</div>
<p>
<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>
helps you implement
security recommendations similar to those described at
<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>
.
</p>
<p>
Normal usage is to connect to the local MySQL server; invoke
<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>
without arguments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa17476292"><div class="copy-help left">Press ⌘+C to 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">mysql_secure_installation</code></pre>
</div>
<p>
When executed,
<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>
prompts you to determine which actions to perform.
</p>
<p>
The
<code class="literal">
validate_password
</code>
component can be used
for password strength checking. If the plugin is not installed,
<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>
prompts the user
whether to install it. Any passwords entered later are checked
using the plugin if it is enabled.
</p>
<p>
Most of the usual MySQL client options such as
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_host">
<code class="option">
--host
</code>
</a>
and
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_port">
<code class="option">
--port
</code>
</a>
can be
used on the command line and in option files. For example, to
connect to the local server over IPv6 using port 3307, use this
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa34964253"><div class="copy-help left">Press ⌘+C to 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">mysql_secure_installation <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>::1</span> <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>3307</span></code></pre>
</div>
<p>
<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>
supports the
following options, which can be specified on the command line or
in the
<code class="literal">
[mysql_secure_installation]
</code>
and
<code class="literal">
[client]
</code>
groups of an option file. For
information about option files used by MySQL programs, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<div class="table">
<a name="idm46045320608816">
</a>
<p class="title">
<b>
Table 6.9 mysql_secure_installation Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for mysql_secure_installation.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-extra-file">
--defaults-extra-file
</a>
</td>
<td>
Read named option file in addition to usual option files
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-group-suffix">
--defaults-group-suffix
</a>
</td>
<td>
Option group suffix value
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_help">
--help
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_host">
--host
</a>
</td>
<td>
Host on which MySQL server is located
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_password">
--password
</a>
</td>
<td>
Accepted but always ignored. Whenever mysql_secure_installation is invoked, the user is prompted for a password, regardless
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_port">
--port
</a>
</td>
<td>
TCP/IP port number for connection
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_print-defaults">
--print-defaults
</a>
</td>
<td>
Print default options
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_protocol">
--protocol
</a>
</td>
<td>
Transport protocol to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_socket">
--socket
</a>
</td>
<td>
Unix socket file or Windows named pipe to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-ca
</a>
</td>
<td>
File that contains list of trusted SSL Certificate Authorities
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-capath
</a>
</td>
<td>
Directory that contains trusted SSL Certificate Authority certificate files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-cert
</a>
</td>
<td>
File that contains X.509 certificate
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-cipher
</a>
</td>
<td>
Permissible ciphers for connection encryption
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-crl
</a>
</td>
<td>
File that contains certificate revocation lists
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-crlpath
</a>
</td>
<td>
Directory that contains certificate revocation-list files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
--ssl-fips-mode
</a>
</td>
<td>
Whether to enable FIPS mode on client side
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-key
</a>
</td>
<td>
File that contains X.509 key
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-command-options.html#option_mysql_ssl">
--ssl-mode
</a>
</td>
<td>
Desired security state of connection to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-session-data
</a>
</td>
<td>
File that contains SSL session data
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl">
--ssl-session-data-continue-on-failed-reuse
</a>
</td>
<td>
Whether to establish connections if session reuse fails
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-ciphersuites">
--tls-ciphersuites
</a>
</td>
<td>
Permissible TLSv1.3 ciphersuites for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-sni-servername">
--tls-sni-servername
</a>
</td>
<td>
Server name supplied by the client
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-version">
--tls-version
</a>
</td>
<td>
Permissible TLS protocols for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_use-default">
--use-default
</a>
</td>
<td>
Execute with no user interactivity
</td>
</tr>
<tr>
<td>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_user">
--user
</a>
</td>
<td>
MySQL user name to use when connecting to server
</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: 260.906px;">
Option Name
</th>
<th style="width: 477.094px;">
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">
<p>
<a name="option_mysql_secure_installation_help">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320521792">
</a>
<a class="indexterm" name="idm46045320520336">
</a>
<p>
Display a help message and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_defaults-extra-file">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320508064">
</a>
<a class="indexterm" name="idm46045320506544">
</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_mysql_secure_installation_defaults-file">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320492384">
</a>
<a class="indexterm" name="idm46045320490880">
</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_mysql_secure_installation_defaults-group-suffix">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320476880">
</a>
<a class="indexterm" name="idm46045320475360">
</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="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>
normally reads
the
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysql_secure_installation]
</code>
groups. If
this option is given as
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=_other
</code>
</a>
,
<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>
also reads the
<code class="literal">
[client_other]
</code>
and
<code class="literal">
[mysql_secure_installation_other]
</code>
groups.
</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_mysql_secure_installation_host">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_host">
<code class="option">
--host=
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</a>
,
<code class="option">
-h
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--host
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320456448">
</a>
<a class="indexterm" name="idm46045320454992">
</a>
<p>
Connect to the MySQL server on the given host.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_no-defaults">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320445008">
</a>
<a class="indexterm" name="idm46045320443504">
</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="mysql-secure-installation.html#option_mysql_secure_installation_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="mysql-secure-installation.html#option_mysql_secure_installation_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_mysql_secure_installation_password">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_password">
<code class="option">
--password=
<em class="replaceable">
<code>
password
</code>
</em>
</code>
</a>
,
<code class="option">
-p
<em class="replaceable">
<code>
password
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password=password
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320420976">
</a>
<a class="indexterm" name="idm46045320419472">
</a>
<p>
This option is accepted but ignored. Whether or not this
option is used,
<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>
always prompts the user for a password.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_port">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
,
<code class="option">
-P
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for port">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--port=port_num
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
3306
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320402976">
</a>
<a class="indexterm" name="idm46045320401520">
</a>
<a class="indexterm" name="idm46045320400016">
</a>
<p>
For TCP/IP connections, the port number to use.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_print-defaults">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_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="idm46045320390464">
</a>
<a class="indexterm" name="idm46045320388960">
</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_mysql_secure_installation_protocol">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_protocol">
<code class="option">
--protocol={TCP|SOCKET|PIPE|MEMORY}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for protocol">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--protocol=type
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[see text]
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
TCP
</code>
</p>
<p class="valid-value">
<code class="literal">
SOCKET
</code>
</p>
<p class="valid-value">
<code class="literal">
PIPE
</code>
</p>
<p class="valid-value">
<code class="literal">
MEMORY
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320367808">
</a>
<a class="indexterm" name="idm46045320366304">
</a>
<p>
The transport protocol to use for connecting to the server.
It is useful when the other connection parameters normally
result in use of a protocol other than the one you want. For
details on the permissible values, see
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_socket">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_socket">
<code class="option">
--socket=
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</a>
,
<code class="option">
-S
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for socket">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--socket={file_name|pipe_name}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320352816">
</a>
<a class="indexterm" name="idm46045320351312">
</a>
<p>
For connections to
<code class="literal">
localhost
</code>
, the Unix
socket file to use, or, on Windows, the name of the named
pipe to use.
</p>
<p>
On Windows, this option applies only if the server was
started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable enabled to support named-pipe connections.
In addition, the connection must be a member of the Windows
group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_ssl">
</a>
<code class="option">
--ssl*
</code>
</p>
<a class="indexterm" name="idm46045320343648">
</a>
<a class="indexterm" name="idm46045320342192">
</a>
<p>
Options that begin with
<code class="option">
--ssl
</code>
specify
whether to connect to the server using encryption and
indicate where to find SSL keys and certificates. See
<a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
Command Options for Encrypted Connections
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_ssl-fips-mode">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
<code class="option">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-fips-mode">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
OFF
</code>
</p>
<p class="valid-value">
<code class="literal">
ON
</code>
</p>
<p class="valid-value">
<code class="literal">
STRICT
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320319904">
</a>
<a class="indexterm" name="idm46045320318400">
</a>
<p>
Controls whether to enable FIPS mode on the client side. The
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
option differs from other
<code class="option">
--ssl-
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
options in that it is not used to establish encrypted
connections, but rather to affect which cryptographic
operations to permit. See
<a class="xref" href="fips-mode.html" title="8.8 FIPS Support">
Section 8.8, “FIPS Support”
</a>
.
</p>
<p>
These
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
values are permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
OFF
</code>
: Disable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ON
</code>
: Enable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STRICT
</code>
: Enable
<span class="quote">
“
<span class="quote">
strict
</span>
”
</span>
FIPS mode.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the OpenSSL FIPS Object Module is not available, the
only permitted value for
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
is
<code class="literal">
OFF
</code>
. In this case, setting
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
to
<code class="literal">
ON
</code>
or
<code class="literal">
STRICT
</code>
causes the client to produce a warning at startup and to
operate in non-FIPS mode.
</p>
</div>
<p>
This option is deprecated. Expect it to be removed in a
future version of MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_tls-ciphersuites">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-ciphersuites">
<code class="option">
--tls-ciphersuites=
<em class="replaceable">
<code>
ciphersuite_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-ciphersuites">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-ciphersuites=ciphersuite_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320291216">
</a>
<a class="indexterm" name="idm46045320289712">
</a>
<p>
The permissible ciphersuites for encrypted connections that
use TLSv1.3. The value is a list of one or more
colon-separated ciphersuite names. The ciphersuites that can
be named for this option depend on the SSL library used to
compile MySQL. For details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_tls-sni-servername">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-sni-servername">
<code class="option">
--tls-sni-servername=
<em class="replaceable">
<code>
server_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-sni-servername">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-sni-servername=server_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320276640">
</a>
<a class="indexterm" name="idm46045320275120">
</a>
<p>
When specified, the name is passed to the
<code class="literal">
libmysqlclient
</code>
C API library using the
<code class="literal">
MYSQL_OPT_TLS_SNI_SERVERNAME
</code>
option of
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
. The server
name is not case-sensitive. To show which server name the
client specified for the current session, if any, check the
<a class="link" href="server-status-variables.html#statvar_Tls_sni_server_name">
<code class="literal">
Tls_sni_server_name
</code>
</a>
status
variable.
</p>
<p>
Server Name Indication (SNI) is an extension to the TLS
protocol (OpenSSL must be compiled using TLS extensions for
this option to function). The MySQL implementation of SNI
represents the client-side only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_tls-version">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_tls-version">
<code class="option">
--tls-version=
<em class="replaceable">
<code>
protocol_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-version=protocol_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
</code>
(OpenSSL 1.1.1 or higher)
</p>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2
</code>
(otherwise)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320254160">
</a>
<a class="indexterm" name="idm46045320252656">
</a>
<p>
The permissible TLS protocols for encrypted connections. The
value is a list of one or more comma-separated protocol
names. The protocols that can be named for this option
depend on the SSL library used to compile MySQL. For
details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_use-default">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_use-default">
<code class="option">
--use-default
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for use-default">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--use-default
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320239920">
</a>
<a class="indexterm" name="idm46045320238416">
</a>
<p>
Execute noninteractively. This option can be used for
unattended installation operations.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_secure_installation_user">
</a>
<a class="link" href="mysql-secure-installation.html#option_mysql_secure_installation_user">
<code class="option">
--user=
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</a>
,
<code class="option">
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for user">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--user=user_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045320225728">
</a>
<a class="indexterm" name="idm46045320224272">
</a>
<p>
The user name of the MySQL account to use for connecting to
the server.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-logs-event-buffer.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-logs-event-buffer">
</a>
25.6.2.3 Event Buffer Reporting in the Cluster Log
</h4>
</div>
</div>
</div>
<p>
<code class="literal">
NDB
</code>
uses one or more memory buffers for
events received from the data nodes. There is one such buffer
for each
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
object subscribing
to table events, which means that there are usually two buffers
for each
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
performing binary logging
(one buffer for schema events, and one for data events). Each
buffer contains epochs made up of events. These events consist
of operation types (insert, update, delete) and row data (before
and after images plus metadata).
</p>
<p>
<code class="literal">
NDB
</code>
generates messages in the cluster log to
describe the state of these buffers. Although these reports
appear in the cluster log, they refer to buffers on API nodes
(unlike most other cluster log messages, which are generated by
data nodes).
</p>
<p>
Event buffer logging reports in the cluster log use the format
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa43673943"><div class="copy-help left">Press ⌘+C to 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">Node <em class="replaceable">node_id</em><span class="token operator">:</span> Event buffer status <span class="token punctuation">(</span><em class="replaceable">object_id</em><span class="token punctuation">)</span><span class="token operator">:</span>
used<span class="token operator">=</span><em class="replaceable">bytes_used</em> <span class="token punctuation">(</span><em class="replaceable">percent_used</em><span class="token operator">%</span> of alloc<span class="token punctuation">)</span>
alloc<span class="token operator">=</span><em class="replaceable">bytes_allocated</em> <span class="token punctuation">(</span><em class="replaceable">percent_alloc</em><span class="token operator">%</span> of max<span class="token punctuation">)</span> max<span class="token operator">=</span><em class="replaceable">bytes_available</em>
latest_consumed_epoch<span class="token operator">=</span><em class="replaceable">latest_consumed_epoch</em>
latest_buffered_epoch<span class="token operator">=</span><em class="replaceable">latest_buffered_epoch</em>
report_reason<span class="token operator">=</span><em class="replaceable">report_reason</em></code></pre>
</div>
<p>
The fields making up this report are listed here, with
descriptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
node_id
</code>
</em>
: ID of the node where the
report originated.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
object_id
</code>
</em>
: ID of the
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
object where the report
originated.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
bytes_used
</code>
</em>
: Number of bytes used
by the buffer.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
percent_used
</code>
</em>
: Percentage of
allocated bytes used.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
bytes_allocated
</code>
</em>
: Number of bytes
allocated to this buffer.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
percent_alloc
</code>
</em>
: Percentage of
available bytes used; not printed if
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_max_alloc">
<code class="literal">
ndb_eventbuffer_max_alloc
</code>
</a>
is equal to 0 (unlimited).
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
bytes_available
</code>
</em>
: Number of bytes
available; this is 0 if
<code class="literal">
ndb_eventbuffer_max_alloc
</code>
is 0
(unlimited).
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
latest_consumed_epoch
</code>
</em>
: The epoch
most recently consumed to completion. (In NDB API
applications, this is done by calling
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent" target="_top">
<code class="literal">
nextEvent()
</code>
</a>
.)
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
latest_buffered_epoch
</code>
</em>
: The epoch
most recently buffered (completely) in the event buffer.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
report_reason
</code>
</em>
: The reason for
making the report. Possible reasons are shown later in this
section.
</p>
</li>
</ul>
</div>
<p>
Possible reasons for reporting are described in the following
list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ENOUGH_FREE_EVENTBUFFER
</code>
: The event buffer
has sufficient space.
</p>
<p>
<code class="literal">
LOW_FREE_EVENTBUFFER
</code>
: The event buffer is
running low on free space.
</p>
<p>
The threshold free percentage level triggering these reports
can be adjusted by setting the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_report_thresh_binlog_mem_usage">
<code class="literal">
ndb_report_thresh_binlog_mem_usage
</code>
</a>
server variable.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BUFFERED_EPOCHS_OVER_THRESHOLD
</code>
: Whether
the number of buffered epochs has exceeded the configured
threshold. This number is the difference between the latest
epoch that has been received in its entirety and the epoch
that has most recently been consumed (in NDB API
applications, this is done by calling
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent" target="_top">
<code class="literal">
nextEvent()
</code>
</a>
or
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent2" target="_top">
<code class="literal">
nextEvent2()
</code>
</a>
). The
report is generated every second until the number of
buffered epochs goes below the threshold, which can be
adjusted by setting the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_report_thresh_binlog_epoch_slip">
<code class="literal">
ndb_report_thresh_binlog_epoch_slip
</code>
</a>
server variable. You can also adjust the threshold in NDB
API applications by calling
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-seteventbufferqueueemptyepoch" target="_top">
<code class="literal">
setEventBufferQueueEmptyEpoch()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PARTIALLY_DISCARDING
</code>
: Event buffer memory
is exhausted—that is, 100% of
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_max_alloc">
<code class="literal">
ndb_eventbuffer_max_alloc
</code>
</a>
has been used. Any partially buffered epoch is buffered to
completion even is usage exceeds 100%, but any new epochs
received are discarded. This means that a gap has occurred
in the event stream.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMPLETELY_DISCARDING
</code>
: No epochs are
buffered.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PARTIALLY_BUFFERING
</code>
: The buffer free
percentage following the gap has risen to the threshold,
which can be set in 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
using the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_free_percent">
<code class="literal">
ndb_eventbuffer_free_percent
</code>
</a>
server system variable or in NDB API applications by calling
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-set-eventbuffer-free-percent" target="_top">
<code class="literal">
set_eventbuffer_free_percent()
</code>
</a>
.
New epochs are buffered. Epochs that could not be completed
due to the gap are discarded.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMPLETELY_BUFFERING
</code>
: All epochs received
are being buffered, which means that there is sufficient
event buffer memory. The gap in the event stream has been
closed.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-schema-auto-increment-columns.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-schema-auto-increment-columns">
</a>
30.4.3.24 The schema_auto_increment_columns View
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062588640">
</a>
<a class="indexterm" name="idm46045062587136">
</a>
<p>
This view indicates which tables have
<code class="literal">
AUTO_INCREMENT
</code>
columns and provides
information about those columns, such as the current and
maximum column values and the usage ratio (ratio of used to
possible values). By default, rows are sorted by descending
usage ratio and maximum column value.
</p>
<p>
Tables in these schemas are excluded from view output:
<code class="literal">
mysql
</code>
,
<code class="literal">
sys
</code>
,
<code class="literal">
INFORMATION_SCHEMA
</code>
,
<code class="literal">
performance_schema
</code>
.
</p>
<p>
The
<a class="link" href="sys-schema-auto-increment-columns.html" title="30.4.3.24 The schema_auto_increment_columns View">
<code class="literal">
schema_auto_increment_columns
</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">
table_schema
</code>
</p>
<p>
The schema that contains the table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table_name
</code>
</p>
<p>
The table that contains the
<code class="literal">
AUTO_INCREMENT
</code>
column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
column_name
</code>
</p>
<p>
The name of the
<code class="literal">
AUTO_INCREMENT
</code>
column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
data_type
</code>
</p>
<p>
The data type of the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
column_type
</code>
</p>
<p>
The column type of the column, which is the data type plus
possibly other information. For example, for a column with
a
<code class="literal">
bigint(20) unsigned
</code>
column type, the
data type is just
<code class="literal">
bigint
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
is_signed
</code>
</p>
<p>
Whether the column type is signed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
is_unsigned
</code>
</p>
<p>
Whether the column type is unsigned.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_value
</code>
</p>
<p>
The maximum permitted value for the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
auto_increment
</code>
</p>
<p>
The current
<code class="literal">
AUTO_INCREMENT
</code>
value for
the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
auto_increment_ratio
</code>
</p>
<p>
The ratio of used to permitted values for the column. This
indicates how much of the sequence of values is
<span class="quote">
“
<span class="quote">
used up.
</span>
”
</span>
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/derived-table-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="derived-table-optimization">
</a>
10.2.2.4 Optimizing Derived Tables, View References, and Common Table Expressions
with Merging or Materialization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227970896">
</a>
<a class="indexterm" name="idm46045227969408">
</a>
<a class="indexterm" name="idm46045227967920">
</a>
<a class="indexterm" name="idm46045227966464">
</a>
<a class="indexterm" name="idm46045227964976">
</a>
<a class="indexterm" name="idm46045227963488">
</a>
<a class="indexterm" name="idm46045227961984">
</a>
<a class="indexterm" name="idm46045227960496">
</a>
<a class="indexterm" name="idm46045227959008">
</a>
<p>
The optimizer can handle derived table references using two
strategies (which also apply to view references and common
table expressions):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Merge the derived table into the outer query block
</p>
</li>
<li class="listitem">
<p>
Materialize the derived table to an internal temporary
table
</p>
</li>
</ul>
</div>
<p>
Example 1:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa38094429"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <span class="token punctuation">(</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 keyword">AS</span> derived_t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
With merging of the derived table
<code class="literal">
derived_t1
</code>
, that query is executed similar
to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89644531"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
Example 2:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30784521"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">JOIN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> t2<span class="token punctuation">.</span>f1 <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span> <span class="token keyword">AS</span> derived_t2 <span class="token keyword">ON</span> t1<span class="token punctuation">.</span>f2<span class="token operator">=</span>derived_t2<span class="token punctuation">.</span>f1
<span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>f1 <span class="token operator">></span> <span class="token number">0</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
With merging of the derived table
<code class="literal">
derived_t2
</code>
, that query is executed similar
to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99484162"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">,</span> t2<span class="token punctuation">.</span>f1
<span class="token keyword">FROM</span> t1 <span class="token keyword">JOIN</span> t2 <span class="token keyword">ON</span> t1<span class="token punctuation">.</span>f2<span class="token operator">=</span>t2<span class="token punctuation">.</span>f1
<span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>f1 <span class="token operator">></span> <span class="token number">0</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
With materialization,
<code class="literal">
derived_t1
</code>
and
<code class="literal">
derived_t2
</code>
are each treated as a separate
table within their respective queries.
</p>
<p>
The optimizer handles derived tables, view references, and
common table expressions the same way: It avoids unnecessary
materialization whenever possible, which enables pushing down
conditions from the outer query to derived tables and produces
more efficient execution plans. (For an example, see
<a class="xref" href="subquery-materialization.html" title="10.2.2.2 Optimizing Subqueries with Materialization">
Section 10.2.2.2, “Optimizing Subqueries with Materialization”
</a>
.)
</p>
<p>
If merging would result in an outer query block that
references more than 61 base tables, the optimizer chooses
materialization instead.
</p>
<p>
The optimizer propagates an
<code class="literal">
ORDER BY
</code>
clause
in a derived table or view reference to the outer query block
if these conditions are all true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The outer query is not grouped or aggregated.
</p>
</li>
<li class="listitem">
<p>
The outer query does not specify
<code class="literal">
DISTINCT
</code>
,
<code class="literal">
HAVING
</code>
, or
<code class="literal">
ORDER BY
</code>
.
</p>
</li>
<li class="listitem">
<p>
The outer query has this derived table or view reference
as the only source in the
<code class="literal">
FROM
</code>
clause.
</p>
</li>
</ul>
</div>
<p>
Otherwise, the optimizer ignores the
<code class="literal">
ORDER
BY
</code>
clause.
</p>
<p>
The following means are available to influence whether the
optimizer attempts to merge derived tables, view references,
and common table expressions into the outer query block:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="optimizer-hints.html#optimizer-hints-table-level" title="Table-Level Optimizer Hints">
<code class="literal">
MERGE
</code>
</a>
and
<a class="link" href="optimizer-hints.html#optimizer-hints-table-level" title="Table-Level Optimizer Hints">
<code class="literal">
NO_MERGE
</code>
</a>
optimizer hints
can be used. They apply assuming that no other rule
prevents merging. See
<a class="xref" href="optimizer-hints.html" title="10.9.3 Optimizer Hints">
Section 10.9.3, “Optimizer Hints”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Similarly, you can use 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. See
<a class="xref" href="switchable-optimizations.html" title="10.9.2 Switchable Optimizations">
Section 10.9.2, “Switchable Optimizations”
</a>
. By default,
the flag is enabled to permit merging. Disabling the flag
prevents merging and avoids
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_update_table_used" target="_top">
<code class="literal">
ER_UPDATE_TABLE_USED
</code>
</a>
errors.
</p>
<p>
The
<a class="link" href="switchable-optimizations.html#optflag_derived-merge">
<code class="literal">
derived_merge
</code>
</a>
flag
also applies to views that contain no
<code class="literal">
ALGORITHM
</code>
clause. Thus, if an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_update_table_used" target="_top">
<code class="literal">
ER_UPDATE_TABLE_USED
</code>
</a>
error
occurs for a view reference that uses an expression
equivalent to the subquery, adding
<code class="literal">
ALGORITHM=TEMPTABLE
</code>
to the view
definition prevents merging and takes precedence over the
<a class="link" href="switchable-optimizations.html#optflag_derived-merge">
<code class="literal">
derived_merge
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
It is possible to disable merging by using in the subquery
any constructs that prevent merging, although these are
not as explicit in their effect on materialization.
Constructs that prevent merging are the same for derived
tables, common table expressions, and view references:
</p>
<div class="itemizedlist">
<a class="indexterm" name="idm46045227917648">
</a>
<a class="indexterm" name="idm46045227916144">
</a>
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Aggregate functions or window functions
(
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
, and so forth)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DISTINCT
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GROUP BY
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HAVING
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LIMIT
</code>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
or
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
ALL
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
Subqueries in the select list
</p>
</li>
<li class="listitem">
<p>
Assignments to user variables
</p>
</li>
<li class="listitem">
<p>
References only to literal values (in this case, there
is no underlying table)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
If the optimizer chooses the materialization strategy rather
than merging for a derived table, it handles the query as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The optimizer postpones derived table materialization
until its contents are needed during query execution. This
improves performance because delaying materialization may
result in not having to do it at all. Consider a query
that joins the result of a derived table to another table:
If the optimizer processes that other table first and
finds that it returns no rows, the join need not be
carried out further and the optimizer can completely skip
materializing the derived table.
</p>
</li>
<li class="listitem">
<p>
During query execution, the optimizer may add an index to
a derived table to speed up row retrieval from it.
</p>
</li>
</ul>
</div>
<p>
Consider the following
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement, for a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
query
that contains a derived table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91662388"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <span class="token punctuation">(</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 keyword">AS</span> derived_t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
The optimizer avoids materializing the derived table by
delaying it until the result is needed during
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
execution. In this case,
the query is not executed (because it occurs in an
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement), so the
result is never needed.
</p>
<p>
Even for queries that are executed, delay of derived table
materialization may enable the optimizer to avoid
materialization entirely. When this happens, query execution
is quicker by the time needed to perform materialization.
Consider the following query, which joins the result of a
derived table to another table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20781638"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">JOIN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> t2<span class="token punctuation">.</span>f1 <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span> <span class="token keyword">AS</span> derived_t2
<span class="token keyword">ON</span> t1<span class="token punctuation">.</span>f2<span class="token operator">=</span>derived_t2<span class="token punctuation">.</span>f1
<span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>f1 <span class="token operator">></span> <span class="token number">0</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the optimization processes
<code class="literal">
t1
</code>
first and
the
<code class="literal">
WHERE
</code>
clause produces an empty result,
the join must necessarily be empty and the derived table need
not be materialized.
</p>
<p>
For cases when a derived table requires materialization, the
optimizer may add an index to the materialized table to speed
up access to it. If such an index enables
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
access to the table, it
can greatly reduce amount of data read during query execution.
Consider the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91634288"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">JOIN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> f1 <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span> <span class="token keyword">AS</span> derived_t2
<span class="token keyword">ON</span> t1<span class="token punctuation">.</span>f1<span class="token operator">=</span>derived_t2<span class="token punctuation">.</span>f1<span class="token punctuation">;</span></code></pre>
</div>
<p>
The optimizer constructs an index over column
<code class="literal">
f1
</code>
from
<code class="literal">
derived_t2
</code>
if
doing so would enable use of
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
access for the lowest
cost execution plan. After adding the index, the optimizer can
treat the materialized derived table the same as a regular
table with an index, and it benefits similarly from the
generated index. The overhead of index creation is negligible
compared to the cost of query execution without the index. If
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
access would result in
higher cost than some other access method, the optimizer
creates no index and loses nothing.
</p>
<p>
For optimizer trace output, a merged derived table or view
reference is not shown as a node. Only its underlying tables
appear in the top query's plan.
</p>
<p>
What is true for materialization of derived tables is also
true for common table expressions (CTEs). In addition, the
following considerations pertain specifically to CTEs.
</p>
<p>
If a CTE is materialized by a query, it is materialized once
for the query, even if the query references it several times.
</p>
<p>
A recursive CTE is always materialized.
</p>
<p>
If a CTE is materialized, the optimizer automatically adds
relevant indexes if it estimates that indexing can speed up
access by the top-level statement to the CTE. This is similar
to automatic indexing of derived tables, except that if the
CTE is referenced multiple times, the optimizer may create
multiple indexes, to speed up access by each reference in the
most appropriate way.
</p>
<p>
The
<a class="link" href="optimizer-hints.html#optimizer-hints-table-level" title="Table-Level Optimizer Hints">
<code class="literal">
MERGE
</code>
</a>
and
<a class="link" href="optimizer-hints.html#optimizer-hints-table-level" title="Table-Level Optimizer Hints">
<code class="literal">
NO_MERGE
</code>
</a>
optimizer hints can
be applied to CTEs. Each CTE reference in the top-level
statement can have its own hint, permitting CTE references to
be selectively merged or materialized. The following statement
uses hints to indicate that
<code class="literal">
cte1
</code>
should be
merged and
<code class="literal">
cte2
</code>
should be materialized:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72530084"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WITH</span>
cte1 <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> a<span class="token punctuation">,</span> b <span class="token keyword">FROM</span> table1<span class="token punctuation">)</span><span class="token punctuation">,</span>
cte2 <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> c<span class="token punctuation">,</span> d <span class="token keyword">FROM</span> table2<span class="token punctuation">)</span>
<span class="token keyword">SELECT</span> <span class="token comment" spellcheck="true">/*+ MERGE(cte1) NO_MERGE(cte2) */</span> cte1<span class="token punctuation">.</span>b<span class="token punctuation">,</span> cte2<span class="token punctuation">.</span>d
<span class="token keyword">FROM</span> cte1 <span class="token keyword">JOIN</span> cte2
<span class="token keyword">WHERE</span> cte1<span class="token punctuation">.</span>a <span class="token operator">=</span> cte2<span class="token punctuation">.</span>c<span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<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>
does not affect
materialization for any
<a class="link" href="with.html" title="15.2.20 WITH (Common Table Expressions)">
<code class="literal">
WITH
</code>
</a>
clause preceding the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement in the view definition. Consider this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa44208767"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TEMPTABLE</span><span class="token operator">|</span><span class="token keyword">MERGE</span>} <span class="token keyword">VIEW</span> v1 <span class="token keyword">AS</span> <span class="token keyword">WITH</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 punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
The
<code class="literal">
ALGORITHM
</code>
value affects materialization
only of the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, not the
<a class="link" href="with.html" title="15.2.20 WITH (Common Table Expressions)">
<code class="literal">
WITH
</code>
</a>
clause.
</p>
<p>
As mentioned previously, a CTE, if materialized, is
materialized once, even if referenced multiple times. To
indicate one-time materialization, optimizer trace output
contains an occurrence of
<code class="literal">
creating_tmp_table
</code>
plus one or more
occurrences of
<code class="literal">
reusing_tmp_table
</code>
.
</p>
<p>
CTEs are similar to derived tables, for which the
<code class="literal">
materialized_from_subquery
</code>
node follows the
reference. This is true for a CTE that is referenced multiple
times, so there is no duplication of
<code class="literal">
materialized_from_subquery
</code>
nodes (which
would give the impression that the subquery is executed
multiple times, and produce unnecessarily verbose output).
Only one reference to the CTE has a complete
<code class="literal">
materialized_from_subquery
</code>
node with the
description of its subquery plan. Other references have a
reduced
<code class="literal">
materialized_from_subquery
</code>
node.
The same idea applies to
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output in
<code class="literal">
TRADITIONAL
</code>
format: Subqueries for other
references are not shown.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-security">
</a>
A.9 MySQL 8.4 FAQ: Security
</h2>
</div>
</div>
</div>
<div class="qandaset">
<a name="idm46045056128208">
</a>
<dl>
<dt>
A.9.1.
<a href="faqs-security.html#faq-mysql-where-docs-security">
Where can I find documentation that addresses security issues
for MySQL?
</a>
</dt>
<dt>
A.9.2.
<a href="faqs-security.html#faq-mysql-default-authentication-plugin">
What is the default authentication plugin in MySQL
8.4?
</a>
</dt>
<dt>
A.9.3.
<a href="faqs-security.html#faq-mysql-have-native-ssl">
Does MySQL have native support for SSL?
</a>
</dt>
<dt>
A.9.4.
<a href="faqs-security.html#faq-mysql-is-ssl-available">
Is SSL support built into MySQL binaries, or must I recompile
the binary myself to enable it?
</a>
</dt>
<dt>
A.9.5.
<a href="faqs-security.html#faq-mysql-have-builtin-ldap">
Does MySQL have built-in authentication against LDAP
directories?
</a>
</dt>
<dt>
A.9.6.
<a href="faqs-security.html#faq-mysql-have-builtin-rbac">
Does MySQL include support for Roles Based Access Control
(RBAC)?
</a>
</dt>
<dt>
A.9.7.
<a href="faqs-security.html#faq-mysql-tls-versions">
Does MySQL support TLS 1.0 and 1.1?
</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-where-docs-security">
</a>
<a name="idm46045056127456">
</a>
<p>
<b>
A.9.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Where can I find documentation that addresses security issues
for MySQL?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
The best place to start is
<a class="xref" href="security.html" title="Chapter 8 Security">
Chapter 8,
<i>
Security
</i>
</a>
.
</p>
<p>
Other portions of the MySQL Documentation which you may find
useful with regard to specific security concerns include the
following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="security-guidelines.html" title="8.1.1 Security Guidelines">
Section 8.1.1, “Security Guidelines”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="resetting-permissions.html" title="B.3.3.2 How to Reset the Root Password">
Section B.3.3.2, “How to Reset the Root Password”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<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>
.
</p>
</li>
<li class="listitem">
<p>
<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>
.
</p>
</li>
<li class="listitem">
<p>
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="postinstallation.html" title="2.9 Postinstallation Setup and Testing">
Section 2.9, “Postinstallation Setup and Testing”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/extending-mysql/8.4/en/adding-loadable-function.html#loadable-function-security" target="_top">
Loadable Function Security Precautions
</a>
.
</p>
</li>
</ul>
</div>
<p>
</p>
<p>
There is also the
<a class="ulink" href="/doc/mysql-secure-deployment-guide/8.0/en/" target="_top">
Secure
Deployment Guide
</a>
, which provides procedures for
deploying a generic binary distribution of MySQL Enterprise Edition Server with
features for managing the security of your MySQL installation.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-default-authentication-plugin">
</a>
<a name="idm46045056108544">
</a>
<p>
<b>
A.9.2.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
What is the default authentication plugin in MySQL
8.4?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
The default authentication plugin as of MySQL 8.0 is
<code class="literal">
caching_sha2_password
</code>
. For information about
this plugin, see
<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>
.
</p>
<p>
The
<code class="literal">
caching_sha2_password
</code>
plugin provides
more secure password encryption than the deprecated
<code class="literal">
mysql_native_password
</code>
plugin (the default
plugin in MySQL versions before MySQL 8.0). For information
about the implications of this change of default plugin for
server operation and compatibility of the server with clients
and connectors, see
<a class="ulink" href="/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" target="_top">
caching_sha2_password as the Preferred Authentication Plugin
</a>
.
</p>
<p>
For general information about pluggable authentication and other
available authentication plugins, see
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
, and
<a class="xref" href="authentication-plugins.html" title="8.4.1 Authentication Plugins">
Section 8.4.1, “Authentication Plugins”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-native-ssl">
</a>
<a name="idm46045056100112">
</a>
<p>
<b>
A.9.3.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have native support for SSL?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes, the binaries have support for SSL connections between the
client and server. See
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
.
</p>
<p>
You can also tunnel a connection using SSH, if (for example) the
client application does not support SSL connections. For an
example, see
<a class="xref" href="windows-and-ssh.html" title="8.3.4 Connecting to MySQL Remotely from Windows with SSH">
Section 8.3.4, “Connecting to MySQL Remotely from Windows with SSH”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-is-ssl-available">
</a>
<a name="idm46045056096176">
</a>
<p>
<b>
A.9.4.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Is SSL support built into MySQL binaries, or must I recompile
the binary myself to enable it?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Yes, the binaries have SSL enabled for client/server connections
that are secured, authenticated, or both. See
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-builtin-ldap">
</a>
<a name="idm46045056093360">
</a>
<p>
<b>
A.9.5.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have built-in authentication against LDAP
directories?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
The Enterprise edition includes a
<a class="link" href="pam-pluggable-authentication.html" title="8.4.1.5 PAM Pluggable Authentication">
PAM Authentication
Plugin
</a>
that supports authentication against an LDAP
directory.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-builtin-rbac">
</a>
<a name="idm46045056090448">
</a>
<p>
<b>
A.9.6.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL include support for Roles Based Access Control
(RBAC)?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Not at this time.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-tls-versions">
</a>
<a name="idm46045056088464">
</a>
<p>
<b>
A.9.7.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL support TLS 1.0 and 1.1?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
Support for the TLSv1 and TLSv1.1 connection protocols is
removed as of MySQL 8.0.28. The protocols were deprecated from
MySQL 8.0.26. For the consequences of that removal, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html#encrypted-connection-deprecated-protocols" title="Removal of Support for the TLSv1 and TLSv1.1 Protocols">
Removal of Support for the TLSv1 and TLSv1.1 Protocols
</a>
.
</p>
<p>
Support for TLS versions 1.0 and 1.1 is removed because those
protocol versions are old, released in 1996 and 2006,
respectively. The algorithms used are weak and outdated.
</p>
<p>
Unless you are using very old versions of MySQL Server or
connectors, you are unlikely to have connections using TLS 1.0
or 1.1. MySQL connectors and clients select the highest TLS
version available by default.
</p>
<p>
<span class="emphasis">
<em>
When was support for TLS 1.2 added to MySQL
Server?
</em>
</span>
MySQL Community Server added TLS 1.2 support
when the community server switched to OpenSSL for MySQL 5.6,
5.7, and 8.0 in 2019. For MySQL Enterprise Edition, OpenSSL added TLS 1.2 support
in 2015, in MySQL Server 5.7.10.
</p>
<p>
<span class="emphasis">
<em>
How can one view which TLS versions are in active
use?
</em>
</span>
For MySQL 5.7 or 8.0, review whether TLS 1.0 or
1.1 is in use by running this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79741828"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>thread_id<span class="token punctuation">`</span><span class="token punctuation">,</span> <span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>ssl_version<span class="token punctuation">`</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>ssl_cipher<span class="token punctuation">`</span><span class="token punctuation">,</span> <span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>ssl_sessions_reused<span class="token punctuation">`</span>
<span class="token keyword">FROM</span> <span class="token punctuation">`</span>sys<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span>
<span class="token keyword">WHERE</span> ssl_version <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'TLSv1.3'</span><span class="token punctuation">,</span><span class="token string">'TLSv1.2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If a thread using TLSv1.0 or TLSv1.1 is listed, you can
determine where this connection is coming from by running this
query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34070341"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> thd_id<span class="token punctuation">,</span>conn_id<span class="token punctuation">,</span> <span class="token keyword">user</span><span class="token punctuation">,</span> db<span class="token punctuation">,</span> current_statement<span class="token punctuation">,</span> program_name
<span class="token keyword">FROM</span> sys<span class="token punctuation">.</span><span class="token keyword">processlist</span>
<span class="token keyword">WHERE</span> thd_id <span class="token keyword">IN</span> <span class="token punctuation">(</span>
<span class="token keyword">SELECT</span> <span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>thread_id<span class="token punctuation">`</span>
<span class="token keyword">FROM</span> <span class="token punctuation">`</span>sys<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span>
<span class="token keyword">WHERE</span> ssl_version <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'TLSv1.3'</span><span class="token punctuation">,</span><span class="token string">'TLSv1.2'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Alternatively, you can run this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64272371"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sys<span class="token punctuation">.</span><span class="token keyword">session</span>
<span class="token keyword">WHERE</span> thd_id <span class="token keyword">IN</span> <span class="token punctuation">(</span>
<span class="token keyword">SELECT</span> <span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>thread_id<span class="token punctuation">`</span>
<span class="token keyword">FROM</span> <span class="token punctuation">`</span>sys<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>session_ssl_status<span class="token punctuation">`</span>
<span class="token keyword">WHERE</span> ssl_version <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'TLSv1.3'</span><span class="token punctuation">,</span><span class="token string">'TLSv1.2'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
These queries provide details needed to determine which
application is not supporting TLS 1.2 or 1.3, and target
upgrades for those.
</p>
<p>
<span class="emphasis">
<em>
Are there other options for testing for TLS 1.0 or
1.1?
</em>
</span>
Yes, you can disable those versions prior to
upgrading your server to a newer version. Explicitly specify
which version to use, either in
<code class="filename">
mysql.cnf
</code>
(or
<code class="filename">
mysql.ini
</code>
) or by using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
PERSIST
</code>
</a>
, for example:
<a class="link" href="server-system-variables.html#sysvar_tls_version">
<code class="literal">
--tls-version=TLSv12
</code>
</a>
.
</p>
<p>
<span class="emphasis">
<em>
Do all MySQL Connectors (5.7 and 8.0) support TLS 1.2
and higher? What about C and C++ applications using
<code class="literal">
libmysql
</code>
?
</em>
</span>
For C and C++
applications using the community
<code class="literal">
libmysqlclient
</code>
library, use an OpenSSL-based
library (that is, do
<span class="emphasis">
<em>
not
</em>
</span>
use YaSSL). Usage
of OpenSSL was unified in 2018 (in MySQL 8.0.4 and 5.7.28,
respectively). The same applies for Connector/ODBC and
Connector/C++. To determine what library dependencies are used,
run the following commands to see if OpenSSL is listed. On
Linux, use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31037388"><div class="copy-help left">Press ⌘+C to 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> ldd usr/local/mysql/lib/libmysqlclient<span class="token punctuation">.</span>a | grep <span class="token property">-i</span> openssl</code></pre>
</div>
<p>
On MacOS, use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa62976448"><div class="copy-help left">Press ⌘+C to 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> otool <span class="token property">-l</span> /usr/local/mysql/lib/libmysqlclient<span class="token punctuation">.</span>a | grep <span class="token property">-i</span> openssl</code></pre>
</div>
<p>
Check the documentation for each connector, but they do support
TLS 1.2 and TLS 1.3.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/get-diagnostics.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="get-diagnostics">
</a>
15.6.7.3 GET DIAGNOSTICS Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045175928240">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53566021"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token punctuation">[</span><span class="token keyword">CURRENT</span> <span class="token operator">|</span> <span class="token keyword">STACKED</span><span class="token punctuation">]</span> <span class="token keyword">DIAGNOSTICS</span> {
<em class="replaceable">statement_information_item</em>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">statement_information_item</em><span class="token punctuation">]</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">CONDITION</span> <em class="replaceable">condition_number</em>
<em class="replaceable">condition_information_item</em>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">condition_information_item</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
}
<em class="replaceable">statement_information_item</em>:
<em class="replaceable">target</em> <span class="token operator">=</span> <em class="replaceable">statement_information_item_name</em>
<em class="replaceable">condition_information_item</em>:
<em class="replaceable">target</em> <span class="token operator">=</span> <em class="replaceable">condition_information_item_name</em>
<em class="replaceable">statement_information_item_name</em>: {
<span class="token keyword">NUMBER</span>
<span class="token operator">|</span> <span class="token keyword">ROW_COUNT</span>
}
<em class="replaceable">condition_information_item_name</em>: {
<span class="token keyword">CLASS_ORIGIN</span>
<span class="token operator">|</span> <span class="token keyword">SUBCLASS_ORIGIN</span>
<span class="token operator">|</span> <span class="token keyword">RETURNED_SQLSTATE</span>
<span class="token operator">|</span> <span class="token keyword">MESSAGE_TEXT</span>
<span class="token operator">|</span> <span class="token keyword">MYSQL_ERRNO</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_CATALOG</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_SCHEMA</span>
<span class="token operator">|</span> <span class="token keyword">CONSTRAINT_NAME</span>
<span class="token operator">|</span> <span class="token keyword">CATALOG_NAME</span>
<span class="token operator">|</span> <span class="token keyword">SCHEMA_NAME</span>
<span class="token operator">|</span> <span class="token keyword">TABLE_NAME</span>
<span class="token operator">|</span> <span class="token keyword">COLUMN_NAME</span>
<span class="token operator">|</span> <span class="token keyword">CURSOR_NAME</span>
}
<em class="replaceable">condition_number</em><span class="token punctuation">,</span> <em class="replaceable">target</em>:
<span class="token punctuation">(</span>see <span class="token keyword">following</span> discussion<span class="token punctuation">)</span></code></pre>
</div>
<p>
SQL statements produce diagnostic information that populates the
diagnostics area. The
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
DIAGNOSTICS
</code>
</a>
statement enables applications to inspect
this information. (You can also use
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW
WARNINGS
</code>
</a>
or
<a class="link" href="show-errors.html" title="15.7.7.18 SHOW ERRORS Statement">
<code class="literal">
SHOW ERRORS
</code>
</a>
to see conditions or errors.)
</p>
<p>
No special privileges are required to execute
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
.
</p>
<p>
The keyword
<code class="literal">
CURRENT
</code>
means to retrieve
information from the current diagnostics area. The keyword
<code class="literal">
STACKED
</code>
means to retrieve information from
the second diagnostics area, which is available only if the
current context is a condition handler. If neither keyword is
given, the default is to use the current diagnostics area.
</p>
<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 is
typically used in a handler within a stored program. It is a
MySQL extension that
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET [CURRENT]
DIAGNOSTICS
</code>
</a>
is permitted outside handler context to
check the execution of any SQL statement. For example, if you
invoke 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, you can
enter these statements at the prompt:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17667820"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> test<span class="token punctuation">.</span>no_such_table<span class="token punctuation">;</span>
<span class="token output">ERROR 1051 (42S02)<span class="token punctuation">:</span> Unknown table 'test.no_such_table'</span>
<span class="token prompt">mysql></span> <span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
<span class="token variable">@p1</span> <span class="token operator">=</span> <span class="token keyword">RETURNED_SQLSTATE</span><span class="token punctuation">,</span> <span class="token variable">@p2</span> <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@p1</span><span class="token punctuation">,</span> <span class="token variable">@p2</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> @p1 <span class="token punctuation">|</span> @p2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 42S02 <span class="token punctuation">|</span> Unknown table 'test.no_such_table' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 extension applies only to the current diagnostics area. It
does not apply to the second diagnostics area because
<code class="literal">
GET STACKED DIAGNOSTICS
</code>
is permitted only if
the current context is a condition handler. If that is not the
case, a
<code class="literal">
GET STACKED DIAGNOSTICS when handler not
active
</code>
error occurs.
</p>
<p>
For a description of the diagnostics area, see
<a class="xref" href="diagnostics-area.html" title="15.6.7.7 The MySQL Diagnostics Area">
Section 15.6.7.7, “The MySQL Diagnostics Area”
</a>
. Briefly, it contains two
kinds of information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Statement information, such as the number of conditions that
occurred or the affected-rows count.
</p>
</li>
<li class="listitem">
<p>
Condition information, such as the error code and message.
If a statement raises multiple conditions, this part of the
diagnostics area has a condition area for each one. If a
statement raises no conditions, this part of the diagnostics
area is empty.
</p>
</li>
</ul>
</div>
<p>
For a statement that produces three conditions, the diagnostics
area contains statement and condition information like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa16444333"><div class="copy-help left">Press ⌘+C to 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">Statement information:
row count
... other statement information items ...
Condition area list:
Condition area 1:
error code for condition 1
error message for condition 1
... other condition information items ...
Condition area 2:
error code for condition 2:
error message for condition 2
... other condition information items ...
Condition area 3:
error code for condition 3
error message for condition 3
... other condition information items ...</code></pre>
</div>
<p>
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
can obtain either
statement or condition information, but not both in the same
statement:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To obtain statement information, retrieve the desired
statement items into target variables. This instance of
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
assigns the
number of available conditions and the rows-affected count
to the user variables
<code class="literal">
@p1
</code>
and
<code class="literal">
@p2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa36243694"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token variable">@p1</span> <span class="token operator">=</span> <span class="token keyword">NUMBER</span><span class="token punctuation">,</span> <span class="token variable">@p2</span> <span class="token operator">=</span> <span class="token keyword">ROW_COUNT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To obtain condition information, specify the condition
number and retrieve the desired condition items into target
variables. This instance of
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
DIAGNOSTICS
</code>
</a>
assigns the SQLSTATE value and error
message to the user variables
<code class="literal">
@p3
</code>
and
<code class="literal">
@p4
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79999504"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
<span class="token variable">@p3</span> <span class="token operator">=</span> <span class="token keyword">RETURNED_SQLSTATE</span><span class="token punctuation">,</span> <span class="token variable">@p4</span> <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The retrieval list specifies one or more
<code class="literal">
<em class="replaceable">
<code>
target
</code>
</em>
=
<em class="replaceable">
<code>
item_name
</code>
</em>
</code>
assignments,
separated by commas. Each assignment names a target variable and
either a
<em class="replaceable">
<code>
statement_information_item_name
</code>
</em>
or
<em class="replaceable">
<code>
condition_information_item_name
</code>
</em>
designator, depending on whether the statement retrieves
statement or condition information.
</p>
<p>
Valid
<em class="replaceable">
<code>
target
</code>
</em>
designators for storing
item information can be stored procedure or function parameters,
stored program local variables declared with
<a class="link" href="declare.html" title="15.6.3 DECLARE Statement">
<code class="literal">
DECLARE
</code>
</a>
, or user-defined
variables.
</p>
<p>
Valid
<em class="replaceable">
<code>
condition_number
</code>
</em>
designators
can be stored procedure or function parameters, stored program
local variables declared with
<a class="link" href="declare.html" title="15.6.3 DECLARE Statement">
<code class="literal">
DECLARE
</code>
</a>
, user-defined variables,
system variables, or literals. A character literal may include a
<em class="replaceable">
<code>
_charset
</code>
</em>
introducer. A warning occurs
if the condition number is not in the range from 1 to the number
of condition areas that have information. In this case, the
warning is added to the diagnostics area without clearing it.
</p>
<p>
When a condition occurs, MySQL does not populate all condition
items recognized by
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
DIAGNOSTICS
</code>
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27860080"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
<span class="token variable">@p5</span> <span class="token operator">=</span> <span class="token keyword">SCHEMA_NAME</span><span class="token punctuation">,</span> <span class="token variable">@p6</span> <span class="token operator">=</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@p5</span><span class="token punctuation">,</span> <span class="token variable">@p6</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> @p5 <span class="token punctuation">|</span> @p6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 standard SQL, if there are multiple conditions, the first
condition relates to the
<code class="literal">
SQLSTATE
</code>
value
returned for the previous SQL statement. In MySQL, this is not
guaranteed. To get the main error, you cannot do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37822294"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span> <span class="token variable">@errno</span> <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Instead, retrieve the condition count first, then use it to
specify which condition number to inspect:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85147644"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token variable">@cno</span> <span class="token operator">=</span> <span class="token keyword">NUMBER</span><span class="token punctuation">;</span>
<span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token variable">@cno</span> <span class="token variable">@errno</span> <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For information about permissible statement and condition
information items, and which ones are populated when a condition
occurs, see
<a class="xref" href="diagnostics-area.html#diagnostics-area-information-items" title="Diagnostics Area Information Items">
Diagnostics Area Information Items
</a>
.
</p>
<p>
Here is an example that uses
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
DIAGNOSTICS
</code>
</a>
and an exception handler in stored
procedure context to assess the outcome of an insert operation.
If the insert was successful, the procedure uses
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
to get the
rows-affected count. This shows that you can use
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
multiple times to
retrieve information about a statement as long as the current
diagnostics area has not been cleared.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8088955"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> do_insert<span class="token punctuation">(</span><span class="token keyword">value</span> <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- Declare variables to hold diagnostics area information</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">code</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">'00000'</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> msg <span class="token datatype">TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> nrows <span class="token datatype">INT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> result <span class="token datatype">TEXT</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Declare exception handler for failed insert</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
<span class="token keyword">code</span> <span class="token operator">=</span> <span class="token keyword">RETURNED_SQLSTATE</span><span class="token punctuation">,</span> msg <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Perform the insert</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token punctuation">(</span>int_col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Check whether the insert was successful</span>
<span class="token keyword">IF</span> <span class="token keyword">code</span> <span class="token operator">=</span> <span class="token string">'00000'</span> <span class="token keyword">THEN</span>
<span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> nrows <span class="token operator">=</span> <span class="token keyword">ROW_COUNT</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> result <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'insert succeeded, row count = '</span><span class="token punctuation">,</span>nrows<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">ELSE</span>
<span class="token keyword">SET</span> result <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'insert failed, error = '</span><span class="token punctuation">,</span><span class="token keyword">code</span><span class="token punctuation">,</span><span class="token string">', message = '</span><span class="token punctuation">,</span>msg<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 comment" spellcheck="true">-- Say what happened</span>
<span class="token keyword">SELECT</span> result<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose that
<code class="literal">
t1.int_col
</code>
is an integer column
that is declared as
<code class="literal">
NOT NULL
</code>
. The procedure
produces these results when invoked to insert
non-
<code class="literal">
NULL
</code>
and
<code class="literal">
NULL
</code>
values,
respectively:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44071147"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CALL</span> do_insert<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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> insert succeeded, row count = 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>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> do_insert<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> insert failed, error = 23000, message = Column 'int_col' cannot be 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 condition handler activates, a push to the diagnostics
area stack occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The first (current) diagnostics area becomes the second
(stacked) diagnostics area and a new current diagnostics
area is created as a copy of it.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
[CURRENT] DIAGNOSTICS
</code>
</a>
and
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET STACKED
DIAGNOSTICS
</code>
</a>
can be used within the handler to
access the contents of the current and stacked diagnostics
areas.
</p>
</li>
<li class="listitem">
<p>
Initially, both diagnostics areas return the same result, so
it is possible to get information from the current
diagnostics area about the condition that activated the
handler,
<span class="emphasis">
<em>
as long as
</em>
</span>
you execute no
statements within the handler that change its current
diagnostics area.
</p>
</li>
<li class="listitem">
<p>
However, statements executing within the handler can modify
the current diagnostics area, clearing and setting its
contents according to the normal rules (see
<a class="xref" href="diagnostics-area.html#diagnostics-area-populating" title="How the Diagnostics Area is Cleared and Populated">
How the Diagnostics Area is Cleared and Populated
</a>
).
</p>
<p>
A more reliable way to obtain information about the
handler-activating condition is to use the stacked
diagnostics area, which cannot be modified by statements
executing within the handler except
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
. For information
about when the current diagnostics area is set and cleared,
see
<a class="xref" href="diagnostics-area.html" title="15.6.7.7 The MySQL Diagnostics Area">
Section 15.6.7.7, “The MySQL Diagnostics Area”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The next example shows how
<code class="literal">
GET STACKED
DIAGNOSTICS
</code>
can be used within a handler to obtain
information about the handled exception, even after the current
diagnostics area has been modified by handler statements.
</p>
<p>
Within a stored procedure
<code class="literal">
p()
</code>
, we attempt to
insert two values into a table that contains a
<code class="literal">
TEXT NOT
NULL
</code>
column. The first value is a
non-
<code class="literal">
NULL
</code>
string and the second is
<code class="literal">
NULL
</code>
. The column prohibits
<code class="literal">
NULL
</code>
values, so the first insert succeeds but
the second causes an exception. The procedure includes an
exception handler that maps attempts to insert
<code class="literal">
NULL
</code>
into inserts of the empty string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69790457"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> t1<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">TEXT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> p<span class="token punctuation">;</span>
<span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> p <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- Declare variables to hold diagnostics area information</span>
<span class="token keyword">DECLARE</span> errcount <span class="token datatype">INT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> errno <span class="token datatype">INT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> msg <span class="token datatype">TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">EXIT</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLEXCEPTION</span>
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- Here the current DA is nonempty because no prior statements</span>
<span class="token comment" spellcheck="true">-- executing within the handler have cleared it</span>
<span class="token keyword">GET</span> <span class="token keyword">CURRENT</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
errno <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">,</span> msg <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token string">'current DA before mapped insert'</span> <span class="token keyword">AS</span> op<span class="token punctuation">,</span> errno<span class="token punctuation">,</span> msg<span class="token punctuation">;</span>
<span class="token keyword">GET</span> <span class="token keyword">STACKED</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
errno <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">,</span> msg <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token string">'stacked DA before mapped insert'</span> <span class="token keyword">AS</span> op<span class="token punctuation">,</span> errno<span class="token punctuation">,</span> msg<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Map attempted NULL insert to empty string insert</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Here the current DA should be empty (if the INSERT succeeded),</span>
<span class="token comment" spellcheck="true">-- so check whether there are conditions before attempting to</span>
<span class="token comment" spellcheck="true">-- obtain condition information</span>
<span class="token keyword">GET</span> <span class="token keyword">CURRENT</span> <span class="token keyword">DIAGNOSTICS</span> errcount <span class="token operator">=</span> <span class="token keyword">NUMBER</span><span class="token punctuation">;</span>
<span class="token keyword">IF</span> errcount <span class="token operator">=</span> <span class="token number">0</span>
<span class="token keyword">THEN</span>
<span class="token keyword">SELECT</span> <span class="token string">'mapped insert succeeded, current DA is empty'</span> <span class="token keyword">AS</span> op<span class="token punctuation">;</span>
<span class="token keyword">ELSE</span>
<span class="token keyword">GET</span> <span class="token keyword">CURRENT</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
errno <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">,</span> msg <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token string">'current DA after mapped insert'</span> <span class="token keyword">AS</span> op<span class="token punctuation">,</span> errno<span class="token punctuation">,</span> msg<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">GET</span> <span class="token keyword">STACKED</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span>
errno <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">,</span> msg <span class="token operator">=</span> <span class="token keyword">MESSAGE_TEXT</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token string">'stacked DA after mapped insert'</span> <span class="token keyword">AS</span> op<span class="token punctuation">,</span> errno<span class="token punctuation">,</span> msg<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">'string 1'</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 punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">VALUES</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 keyword">END</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">//</span>
<span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token keyword">CALL</span> p<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> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
When the handler activates, a copy of the current diagnostics
area is pushed to the diagnostics area stack. The handler first
displays the contents of the current and stacked diagnostics
areas, which are both the same initially:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa28258247"><div class="copy-help left">Press ⌘+C to 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">+---------------------------------+-------+----------------------------+
| op | errno | msg |
+---------------------------------+-------+----------------------------+
| current DA before mapped insert | 1048 | Column 'c1' cannot be null |
+---------------------------------+-------+----------------------------+
+---------------------------------+-------+----------------------------+
| op | errno | msg |
+---------------------------------+-------+----------------------------+
| stacked DA before mapped insert | 1048 | Column 'c1' cannot be null |
+---------------------------------+-------+----------------------------+</code></pre>
</div>
<p>
Statements executing after the
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET
DIAGNOSTICS
</code>
</a>
statements may reset the current
diagnostics area. statements may reset the current diagnostics
area. For example, the handler maps the
<code class="literal">
NULL
</code>
insert to an empty-string insert and displays the result. The
new insert succeeds and clears the current diagnostics area, but
the stacked diagnostics area remains unchanged and still
contains information about the condition that activated the
handler:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa4719186"><div class="copy-help left">Press ⌘+C to 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">+----------------------------------------------+
| op |
+----------------------------------------------+
| mapped insert succeeded, current DA is empty |
+----------------------------------------------+
+--------------------------------+-------+----------------------------+
| op | errno | msg |
+--------------------------------+-------+----------------------------+
| stacked DA after mapped insert | 1048 | Column 'c1' cannot be null |
+--------------------------------+-------+----------------------------+</code></pre>
</div>
<p>
When the condition handler ends, its current diagnostics area is
popped from the stack and the stacked diagnostics area becomes
the current diagnostics area in the stored procedure.
</p>
<p>
After the procedure returns, the table contains two rows. The
empty row results from the attempt to insert
<code class="literal">
NULL
</code>
that was mapped to an empty-string
insert:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa3298120"><div class="copy-help left">Press ⌘+C to 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">+----------+
| c1 |
+----------+
| string 1 |
| |
+----------+</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/source-installation-prerequisites.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="source-installation-prerequisites">
</a>
2.8.2 Source Installation Prerequisites
</h3>
</div>
</div>
</div>
<p>
Installation of MySQL from source requires several development
tools. Some of these tools are needed no matter whether you use a
standard source distribution or a development source tree. Other
tool requirements depend on which installation method you use.
</p>
<p>
To install MySQL from source, the following system requirements
must be satisfied, regardless of installation method:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="command">
<strong>
CMake
</strong>
</span>
, which is used as the build framework
on all platforms.
<span class="command">
<strong>
CMake
</strong>
</span>
can be downloaded
from
<a class="ulink" href="http://www.cmake.org" target="_blank">
http://www.cmake.org
</a>
.
</p>
</li>
<li class="listitem">
<p>
A good
<span class="command">
<strong>
make
</strong>
</span>
program. Although some
platforms come with their own
<span class="command">
<strong>
make
</strong>
</span>
implementations, it is highly recommended that you use GNU
<span class="command">
<strong>
make
</strong>
</span>
3.75 or later. It may already be
available on your system as
<span class="command">
<strong>
gmake
</strong>
</span>
. GNU
<span class="command">
<strong>
make
</strong>
</span>
is available from
<a class="ulink" href="http://www.gnu.org/software/make/" target="_blank">
http://www.gnu.org/software/make/
</a>
.
</p>
<p>
On Unix-like systems, including Linux, you can check your
system's version of
<span class="command">
<strong>
make
</strong>
</span>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa4733114"><div class="copy-help left">Press ⌘+C to 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> <span class="token property">--version</span>
GNU Make 4<span class="token punctuation">.</span>2<span class="token punctuation">.</span>1</code></pre>
</div>
</li>
<li class="listitem">
<p>
MySQL 8.4 source code permits use of C++17
features. To enable the necessary level of C++17 support
across all supported platforms, the following minimum compiler
versions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Linux: GCC 10 or Clang 12
</p>
</li>
<li class="listitem">
<p>
macOS: XCode 10
</p>
</li>
<li class="listitem">
<p>
Solaris: (
<span class="emphasis">
<em>
Prior to MySQL 8.4.4
</em>
</span>
) GCC
10; (
<span class="emphasis">
<em>
MySQL 8.4.4 and later
</em>
</span>
) GCC 11.4
</p>
</li>
<li class="listitem">
<p>
Windows: Visual Studio 2019
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The MySQL C API requires a C++ or C99 compiler to compile.
</p>
</li>
<li class="listitem">
<p>
An SSL library is required for support of encrypted
connections, entropy for random number generation, and other
encryption-related operations. By default, the build uses the
OpenSSL library installed on the host system. To specify the
library explicitly, use the
<a class="link" href="source-configuration-options.html#option_cmake_with_ssl">
<code class="option">
WITH_SSL
</code>
</a>
option when you invoke
<span class="command">
<strong>
CMake
</strong>
</span>
. For additional information, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="ulink" href="http://www.boost.org/" target="_blank">
Boost C++
libraries
</a>
are required to build MySQL (but not to use
it). In MySQL 8.3 and later, these libraries are always
bundled with the MySQL source.
</p>
</li>
<li class="listitem">
<p>
The
<a class="ulink" href="https://www.gnu.org/software/ncurses/ncurses.html" target="_blank">
ncurses
</a>
library.
</p>
</li>
<li class="listitem">
<p>
Sufficient free memory. If you encounter build errors such as
<span class="errortext">
internal compiler error
</span>
when compiling
large source files, it may be that you have too little memory.
If compiling on a virtual machine, try increasing the memory
allocation.
</p>
</li>
<li class="listitem">
<p>
Perl is needed if you intend to run test scripts. Most
Unix-like systems include Perl. For Windows, you can use
<a class="ulink" href="https://www.activestate.com/products/perl/" target="_blank">
ActiveState
Perl
</a>
. or
<a class="ulink" href="https://strawberryperl.com/" target="_blank">
Strawberry
Perl
</a>
.
</p>
</li>
</ul>
</div>
<p>
To install MySQL from a standard source distribution, one of the
following tools is required to unpack the distribution file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For a
<code class="filename">
.tar.gz
</code>
compressed
<span class="command">
<strong>
tar
</strong>
</span>
file: GNU
<code class="literal">
gunzip
</code>
to
uncompress the distribution and a reasonable
<span class="command">
<strong>
tar
</strong>
</span>
to unpack it. If your
<span class="command">
<strong>
tar
</strong>
</span>
program supports the
<code class="literal">
z
</code>
option, it can both uncompress and unpack
the file.
</p>
<p>
GNU
<span class="command">
<strong>
tar
</strong>
</span>
is known to work. The standard
<span class="command">
<strong>
tar
</strong>
</span>
provided with some operating systems is
not able to unpack the long file names in the MySQL
distribution. You should download and install GNU
<span class="command">
<strong>
tar
</strong>
</span>
, or if available, use a preinstalled
version of GNU tar. Usually this is available as
<span class="command">
<strong>
gnutar
</strong>
</span>
,
<span class="command">
<strong>
gtar
</strong>
</span>
, or as
<span class="command">
<strong>
tar
</strong>
</span>
within a GNU or Free Software
directory, such as
<code class="filename">
/usr/sfw/bin
</code>
or
<code class="filename">
/usr/local/bin
</code>
. GNU
<span class="command">
<strong>
tar
</strong>
</span>
is available from
<a class="ulink" href="https://www.gnu.org/software/tar/" target="_blank">
https://www.gnu.org/software/tar/
</a>
.
</p>
</li>
<li class="listitem">
<p>
For a
<code class="filename">
.zip
</code>
Zip archive:
<span class="command">
<strong>
WinZip
</strong>
</span>
or another tool that can read
<code class="filename">
.zip
</code>
files.
</p>
</li>
<li class="listitem">
<p>
For an
<code class="filename">
.rpm
</code>
RPM package: The
<span class="command">
<strong>
rpmbuild
</strong>
</span>
program used to build the
distribution unpacks it.
</p>
</li>
</ul>
</div>
<p>
To install MySQL from a development source tree, the following
additional tools are required:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The Git revision control system is required to obtain the
development source code.
<a class="ulink" href="https://help.github.com/" target="_blank">
GitHub Help
</a>
provides instructions for downloading and installing Git on
different platforms.
</p>
</li>
<li class="listitem">
<p>
<span class="command">
<strong>
bison
</strong>
</span>
2.1 or later, available from
<a class="ulink" href="http://www.gnu.org/software/bison/" target="_blank">
http://www.gnu.org/software/bison/
</a>
. (Version 1
is no longer supported.) Use the latest version of
<span class="command">
<strong>
bison
</strong>
</span>
where possible; if you experience
problems, upgrade to a later version, rather than revert to an
earlier one.
</p>
<p>
<span class="command">
<strong>
bison
</strong>
</span>
is available from
<a class="ulink" href="http://www.gnu.org/software/bison/" target="_blank">
http://www.gnu.org/software/bison/
</a>
.
<code class="literal">
bison
</code>
for Windows can be downloaded from
<a class="ulink" href="http://gnuwin32.sourceforge.net/packages/bison.htm" target="_blank">
http://gnuwin32.sourceforge.net/packages/bison.htm
</a>
.
Download the package labeled
<span class="quote">
“
<span class="quote">
Complete package,
excluding sources
</span>
”
</span>
. On Windows, the default location
for
<span class="command">
<strong>
bison
</strong>
</span>
is the
<code class="filename">
C:\Program
Files\GnuWin32
</code>
directory. Some utilities may fail
to find
<span class="command">
<strong>
bison
</strong>
</span>
because of the space in the
directory name. Also, Visual Studio may simply hang if there
are spaces in the path. You can resolve these problems by
installing into a directory that does not contain a space (for
example
<code class="filename">
C:\GnuWin32
</code>
).
</p>
</li>
<li class="listitem">
<p>
On Solaris Express,
<span class="command">
<strong>
m4
</strong>
</span>
must be installed in
addition to
<span class="command">
<strong>
bison
</strong>
</span>
.
<span class="command">
<strong>
m4
</strong>
</span>
is
available from
<a class="ulink" href="http://www.gnu.org/software/m4/" target="_blank">
http://www.gnu.org/software/m4/
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you have to install any programs, modify your
<code class="literal">
PATH
</code>
environment variable to include any
directories in which the programs are located. See
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
.
</p>
</div>
<p>
If you run into problems and need to file a bug report, please use
the instructions in
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/creating-ssl-files-using-openssl.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="creating-ssl-files-using-openssl">
</a>
8.3.3.2 Creating SSL Certificates and Keys Using openssl
</h4>
</div>
</div>
</div>
<p>
This section describes how to use the
<span class="command">
<strong>
openssl
</strong>
</span>
command to set up SSL certificate and key files for use by MySQL
servers and clients. The first example shows a simplified
procedure such as you might use from the command line. The
second shows a script that contains more detail. The first two
examples are intended for use on Unix and both use the
<span class="command">
<strong>
openssl
</strong>
</span>
command that is part of OpenSSL. The
third example describes how to set up SSL files on Windows.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
An easier alternative to generating the files required for SSL
than the procedure described here is to let the server
autogenerate them; see
<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>
.
</p>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Whatever method you use to generate the certificate and key
files, the Common Name value used for the server and client
certificates/keys must each differ from the Common Name value
used for the CA certificate. Otherwise, the certificate and
key files do not work for servers compiled using OpenSSL. A
typical error in this case is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa63122740"><div class="copy-help left">Press ⌘+C to 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">ERROR 2026 (HY000): SSL connection error:
error:00000001:lib(0):func(0):reason(1)</code></pre>
</div>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
If a client connecting to a MySQL server instance uses an SSL
certificate with the
<code class="literal">
extendedKeyUsage
</code>
extension (an X.509 v3 extension), the extended key usage must
include client authentication (
<code class="literal">
clientAuth
</code>
).
If the SSL certificate is only specified for server
authentication (
<code class="literal">
serverAuth
</code>
) and other
non-client certificate purposes, certificate verification
fails and the client connection to the MySQL server instance
fails. There is no
<code class="literal">
extendedKeyUsage
</code>
extension in SSL certificates created using the
<span class="command">
<strong>
openssl
</strong>
</span>
command following the instructions
in this topic. If you use your own client certificate created
in another way, ensure any
<code class="literal">
extendedKeyUsage
</code>
extension includes client authentication.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="creating-ssl-files-using-openssl.html#creating-ssl-files-using-openssl-unix-command-line" title="Example 1: Creating SSL Files from the Command Line on Unix">
Example 1: Creating SSL Files from the Command Line on Unix
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="creating-ssl-files-using-openssl.html#creating-ssl-files-using-openssl-unix-script" title="Example 2: Creating SSL Files Using a Script on Unix">
Example 2: Creating SSL Files Using a Script on Unix
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="creating-ssl-files-using-openssl.html#creating-ssl-files-using-openssl-windows" title="Example 3: Creating SSL Files on Windows">
Example 3: Creating SSL Files on Windows
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="creating-ssl-files-using-openssl-unix-command-line">
</a>
Example 1: Creating SSL Files from the Command Line on Unix
</h5>
</div>
</div>
</div>
<p>
The following example shows a set of commands to create MySQL
server and client certificate and key files. You must respond
to several prompts by the
<span class="command">
<strong>
openssl
</strong>
</span>
commands.
To generate test files, you can press Enter to all prompts. To
generate files for production use, you should provide nonempty
responses.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa6459790"><div class="copy-help left">Press ⌘+C to 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 comment" spellcheck="true"># Create clean environment</span>
rm <span class="token property">-rf</span> newcerts
mkdir newcerts && cd newcerts
<span class="token comment" spellcheck="true"># Create CA certificate</span>
openssl genrsa 2048 > ca-key<span class="token punctuation">.</span>pem
openssl req <span class="token property">-new</span> <span class="token property">-x509</span> <span class="token property">-nodes</span> <span class="token property">-days</span> 3600 \
<span class="token property">-key</span> ca-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> ca<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true"># Create server certificate, remove passphrase, and sign it</span>
<span class="token comment" spellcheck="true"># server-cert.pem = public key, server-key.pem = private key</span>
openssl req <span class="token property">-newkey</span> rsa<span class="token punctuation">:</span>2048 <span class="token property">-days</span> 3600 \
<span class="token property">-nodes</span> <span class="token property">-keyout</span> server-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> server-req<span class="token punctuation">.</span>pem
openssl rsa <span class="token property">-in</span> server-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> server-key<span class="token punctuation">.</span>pem
openssl x509 <span class="token property">-req</span> <span class="token property">-in</span> server-req<span class="token punctuation">.</span>pem <span class="token property">-days</span> 3600 \
<span class="token property">-CA</span> ca<span class="token punctuation">.</span>pem <span class="token property">-CAkey</span> ca-key<span class="token punctuation">.</span>pem <span class="token property">-set_serial</span> 01 <span class="token property">-out</span> server-cert<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true"># Create client certificate, remove passphrase, and sign it</span>
<span class="token comment" spellcheck="true"># client-cert.pem = public key, client-key.pem = private key</span>
openssl req <span class="token property">-newkey</span> rsa<span class="token punctuation">:</span>2048 <span class="token property">-days</span> 3600 \
<span class="token property">-nodes</span> <span class="token property">-keyout</span> client-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> client-req<span class="token punctuation">.</span>pem
openssl rsa <span class="token property">-in</span> client-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> client-key<span class="token punctuation">.</span>pem
openssl x509 <span class="token property">-req</span> <span class="token property">-in</span> client-req<span class="token punctuation">.</span>pem <span class="token property">-days</span> 3600 \
<span class="token property">-CA</span> ca<span class="token punctuation">.</span>pem <span class="token property">-CAkey</span> ca-key<span class="token punctuation">.</span>pem <span class="token property">-set_serial</span> 01 <span class="token property">-out</span> client-cert<span class="token punctuation">.</span>pem</code></pre>
</div>
<p>
After generating the certificates, verify them:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa6395086"><div class="copy-help left">Press ⌘+C to 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 verify <span class="token property">-CAfile</span> ca<span class="token punctuation">.</span>pem server-cert<span class="token punctuation">.</span>pem client-cert<span class="token punctuation">.</span>pem</code></pre>
</div>
<p>
You should see a response like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95197928"><div class="copy-help left">Press ⌘+C to 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">server-cert.pem: OK
client-cert.pem: OK</code></pre>
</div>
<p>
To see the contents of a certificate (for example, to check
the range of dates over which a certificate is valid), invoke
<span class="command">
<strong>
openssl
</strong>
</span>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa82776859"><div class="copy-help left">Press ⌘+C to 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 x509 <span class="token property">-text</span> <span class="token property">-in</span> ca<span class="token punctuation">.</span>pem
openssl x509 <span class="token property">-text</span> <span class="token property">-in</span> server-cert<span class="token punctuation">.</span>pem
openssl x509 <span class="token property">-text</span> <span class="token property">-in</span> client-cert<span class="token punctuation">.</span>pem</code></pre>
</div>
<p>
Now you have a set of files that can be used as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="filename">
ca.pem
</code>
: Use this to set the
<a class="link" href="server-system-variables.html#sysvar_ssl_ca">
<code class="literal">
ssl_ca
</code>
</a>
system variable on
the server side and the
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
option on the
client side. (The CA certificate, if used, must be the
same on both sides.)
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
server-cert.pem
</code>
,
<code class="filename">
server-key.pem
</code>
: Use these to set the
<a class="link" href="server-system-variables.html#sysvar_ssl_cert">
<code class="literal">
ssl_cert
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_ssl_key">
<code class="literal">
ssl_key
</code>
</a>
system variables
on the server side.
</p>
</li>
<li class="listitem">
<p>
<code class="filename">
client-cert.pem
</code>
,
<code class="filename">
client-key.pem
</code>
: Use these as the
arguments to the
<a class="link" href="connection-options.html#option_general_ssl-cert">
<code class="option">
--ssl-cert
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-key">
<code class="option">
--ssl-key
</code>
</a>
options on the
client side.
</p>
</li>
</ul>
</div>
<p>
For additional usage instructions, see
<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>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="creating-ssl-files-using-openssl-unix-script">
</a>
Example 2: Creating SSL Files Using a Script on Unix
</h5>
</div>
</div>
</div>
<p>
Here is an example script that shows how to set up SSL
certificate and key files for MySQL. After executing the
script, use the files for SSL connections as described in
<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>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa66149182"><div class="copy-help left">Press ⌘+C to 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">DIR<span class="token attr-value"><span class="token punctuation">=</span>`pwd`/openssl</span>
PRIV<span class="token attr-value"><span class="token punctuation">=</span>$DIR/private</span>
mkdir $DIR $PRIV $DIR/newcerts
cp /usr/share/ssl/openssl<span class="token punctuation">.</span>cnf $DIR
replace <span class="token punctuation">.</span>/demoCA $DIR <span class="token property">--</span> $DIR/openssl<span class="token punctuation">.</span>cnf
<span class="token comment" spellcheck="true"># Create necessary files: $database, $serial and $new_certs_dir</span>
<span class="token comment" spellcheck="true"># directory (optional)</span>
touch $DIR/index<span class="token punctuation">.</span>txt
echo <span class="token atrule">"01"</span> > $DIR/serial
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Generation of Certificate Authority(CA)</span>
<span class="token comment" spellcheck="true">#</span>
openssl req <span class="token property">-new</span> <span class="token property">-x509</span> <span class="token property">-keyout</span> $PRIV/cakey<span class="token punctuation">.</span>pem <span class="token property">-out</span> $DIR/ca<span class="token punctuation">.</span>pem \
<span class="token property">-days</span> 3600 <span class="token property">-config</span> $DIR/openssl<span class="token punctuation">.</span>cnf
<span class="token comment" spellcheck="true"># Sample output:</span>
<span class="token comment" spellcheck="true"># Using configuration from /home/jones/openssl/openssl.cnf</span>
<span class="token comment" spellcheck="true"># Generating a 1024 bit RSA private key</span>
<span class="token comment" spellcheck="true"># ................++++++</span>
<span class="token comment" spellcheck="true"># .........++++++</span>
<span class="token comment" spellcheck="true"># writing new private key to '/home/jones/openssl/private/cakey.pem'</span>
<span class="token comment" spellcheck="true"># Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># Verifying password - Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># You are about to be asked to enter information to be</span>
<span class="token comment" spellcheck="true"># incorporated into your certificate request.</span>
<span class="token comment" spellcheck="true"># What you are about to enter is what is called a Distinguished Name</span>
<span class="token comment" spellcheck="true"># or a DN.</span>
<span class="token comment" spellcheck="true"># There are quite a few fields but you can leave some blank</span>
<span class="token comment" spellcheck="true"># For some fields there will be a default value,</span>
<span class="token comment" spellcheck="true"># If you enter '.', the field will be left blank.</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># Country Name (2 letter code) [AU]:FI</span>
<span class="token comment" spellcheck="true"># State or Province Name (full name) [Some-State]:.</span>
<span class="token comment" spellcheck="true"># Locality Name (eg, city) []:</span>
<span class="token comment" spellcheck="true"># Organization Name (eg, company) [Internet Widgits Pty Ltd]:MySQL AB</span>
<span class="token comment" spellcheck="true"># Organizational Unit Name (eg, section) []:</span>
<span class="token comment" spellcheck="true"># Common Name (eg, YOUR name) []:MySQL admin</span>
<span class="token comment" spellcheck="true"># Email Address []:</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Create server request and key</span>
<span class="token comment" spellcheck="true">#</span>
openssl req <span class="token property">-new</span> <span class="token property">-keyout</span> $DIR/server-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> \
$DIR/server-req<span class="token punctuation">.</span>pem <span class="token property">-days</span> 3600 <span class="token property">-config</span> $DIR/openssl<span class="token punctuation">.</span>cnf
<span class="token comment" spellcheck="true"># Sample output:</span>
<span class="token comment" spellcheck="true"># Using configuration from /home/jones/openssl/openssl.cnf</span>
<span class="token comment" spellcheck="true"># Generating a 1024 bit RSA private key</span>
<span class="token comment" spellcheck="true"># ..++++++</span>
<span class="token comment" spellcheck="true"># ..........++++++</span>
<span class="token comment" spellcheck="true"># writing new private key to '/home/jones/openssl/server-key.pem'</span>
<span class="token comment" spellcheck="true"># Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># Verifying password - Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># You are about to be asked to enter information that will be</span>
<span class="token comment" spellcheck="true"># incorporated into your certificate request.</span>
<span class="token comment" spellcheck="true"># What you are about to enter is what is called a Distinguished Name</span>
<span class="token comment" spellcheck="true"># or a DN.</span>
<span class="token comment" spellcheck="true"># There are quite a few fields but you can leave some blank</span>
<span class="token comment" spellcheck="true"># For some fields there will be a default value,</span>
<span class="token comment" spellcheck="true"># If you enter '.', the field will be left blank.</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># Country Name (2 letter code) [AU]:FI</span>
<span class="token comment" spellcheck="true"># State or Province Name (full name) [Some-State]:.</span>
<span class="token comment" spellcheck="true"># Locality Name (eg, city) []:</span>
<span class="token comment" spellcheck="true"># Organization Name (eg, company) [Internet Widgits Pty Ltd]:MySQL AB</span>
<span class="token comment" spellcheck="true"># Organizational Unit Name (eg, section) []:</span>
<span class="token comment" spellcheck="true"># Common Name (eg, YOUR name) []:MySQL server</span>
<span class="token comment" spellcheck="true"># Email Address []:</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Please enter the following 'extra' attributes</span>
<span class="token comment" spellcheck="true"># to be sent with your certificate request</span>
<span class="token comment" spellcheck="true"># A challenge password []:</span>
<span class="token comment" spellcheck="true"># An optional company name []:</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Remove the passphrase from the key</span>
<span class="token comment" spellcheck="true">#</span>
openssl rsa <span class="token property">-in</span> $DIR/server-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> $DIR/server-key<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Sign server cert</span>
<span class="token comment" spellcheck="true">#</span>
openssl ca <span class="token property">-cert</span> $DIR/ca<span class="token punctuation">.</span>pem <span class="token property">-policy</span> policy_anything \
<span class="token property">-out</span> $DIR/server-cert<span class="token punctuation">.</span>pem <span class="token property">-config</span> $DIR/openssl<span class="token punctuation">.</span>cnf \
<span class="token property">-infiles</span> $DIR/server-req<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true"># Sample output:</span>
<span class="token comment" spellcheck="true"># Using configuration from /home/jones/openssl/openssl.cnf</span>
<span class="token comment" spellcheck="true"># Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># Check that the request matches the signature</span>
<span class="token comment" spellcheck="true"># Signature ok</span>
<span class="token comment" spellcheck="true"># The Subjects Distinguished Name is as follows</span>
<span class="token comment" spellcheck="true"># countryName :PRINTABLE:'FI'</span>
<span class="token comment" spellcheck="true"># organizationName :PRINTABLE:'MySQL AB'</span>
<span class="token comment" spellcheck="true"># commonName :PRINTABLE:'MySQL admin'</span>
<span class="token comment" spellcheck="true"># Certificate is to be certified until Sep 13 14:22:46 2003 GMT</span>
<span class="token comment" spellcheck="true"># (365 days)</span>
<span class="token comment" spellcheck="true"># Sign the certificate? [y/n]:y</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># 1 out of 1 certificate requests certified, commit? [y/n]y</span>
<span class="token comment" spellcheck="true"># Write out database with 1 new entries</span>
<span class="token comment" spellcheck="true"># Data Base Updated</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Create client request and key</span>
<span class="token comment" spellcheck="true">#</span>
openssl req <span class="token property">-new</span> <span class="token property">-keyout</span> $DIR/client-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> \
$DIR/client-req<span class="token punctuation">.</span>pem <span class="token property">-days</span> 3600 <span class="token property">-config</span> $DIR/openssl<span class="token punctuation">.</span>cnf
<span class="token comment" spellcheck="true"># Sample output:</span>
<span class="token comment" spellcheck="true"># Using configuration from /home/jones/openssl/openssl.cnf</span>
<span class="token comment" spellcheck="true"># Generating a 1024 bit RSA private key</span>
<span class="token comment" spellcheck="true"># .....................................++++++</span>
<span class="token comment" spellcheck="true"># .............................................++++++</span>
<span class="token comment" spellcheck="true"># writing new private key to '/home/jones/openssl/client-key.pem'</span>
<span class="token comment" spellcheck="true"># Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># Verifying password - Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># You are about to be asked to enter information that will be</span>
<span class="token comment" spellcheck="true"># incorporated into your certificate request.</span>
<span class="token comment" spellcheck="true"># What you are about to enter is what is called a Distinguished Name</span>
<span class="token comment" spellcheck="true"># or a DN.</span>
<span class="token comment" spellcheck="true"># There are quite a few fields but you can leave some blank</span>
<span class="token comment" spellcheck="true"># For some fields there will be a default value,</span>
<span class="token comment" spellcheck="true"># If you enter '.', the field will be left blank.</span>
<span class="token comment" spellcheck="true"># -----</span>
<span class="token comment" spellcheck="true"># Country Name (2 letter code) [AU]:FI</span>
<span class="token comment" spellcheck="true"># State or Province Name (full name) [Some-State]:.</span>
<span class="token comment" spellcheck="true"># Locality Name (eg, city) []:</span>
<span class="token comment" spellcheck="true"># Organization Name (eg, company) [Internet Widgits Pty Ltd]:MySQL AB</span>
<span class="token comment" spellcheck="true"># Organizational Unit Name (eg, section) []:</span>
<span class="token comment" spellcheck="true"># Common Name (eg, YOUR name) []:MySQL user</span>
<span class="token comment" spellcheck="true"># Email Address []:</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Please enter the following 'extra' attributes</span>
<span class="token comment" spellcheck="true"># to be sent with your certificate request</span>
<span class="token comment" spellcheck="true"># A challenge password []:</span>
<span class="token comment" spellcheck="true"># An optional company name []:</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Remove the passphrase from the key</span>
<span class="token comment" spellcheck="true">#</span>
openssl rsa <span class="token property">-in</span> $DIR/client-key<span class="token punctuation">.</span>pem <span class="token property">-out</span> $DIR/client-key<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Sign client cert</span>
<span class="token comment" spellcheck="true">#</span>
openssl ca <span class="token property">-cert</span> $DIR/ca<span class="token punctuation">.</span>pem <span class="token property">-policy</span> policy_anything \
<span class="token property">-out</span> $DIR/client-cert<span class="token punctuation">.</span>pem <span class="token property">-config</span> $DIR/openssl<span class="token punctuation">.</span>cnf \
<span class="token property">-infiles</span> $DIR/client-req<span class="token punctuation">.</span>pem
<span class="token comment" spellcheck="true"># Sample output:</span>
<span class="token comment" spellcheck="true"># Using configuration from /home/jones/openssl/openssl.cnf</span>
<span class="token comment" spellcheck="true"># Enter PEM pass phrase:</span>
<span class="token comment" spellcheck="true"># Check that the request matches the signature</span>
<span class="token comment" spellcheck="true"># Signature ok</span>
<span class="token comment" spellcheck="true"># The Subjects Distinguished Name is as follows</span>
<span class="token comment" spellcheck="true"># countryName :PRINTABLE:'FI'</span>
<span class="token comment" spellcheck="true"># organizationName :PRINTABLE:'MySQL AB'</span>
<span class="token comment" spellcheck="true"># commonName :PRINTABLE:'MySQL user'</span>
<span class="token comment" spellcheck="true"># Certificate is to be certified until Sep 13 16:45:17 2003 GMT</span>
<span class="token comment" spellcheck="true"># (365 days)</span>
<span class="token comment" spellcheck="true"># Sign the certificate? [y/n]:y</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># 1 out of 1 certificate requests certified, commit? [y/n]y</span>
<span class="token comment" spellcheck="true"># Write out database with 1 new entries</span>
<span class="token comment" spellcheck="true"># Data Base Updated</span>
<span class="token comment" spellcheck="true">#</span>
<span class="token comment" spellcheck="true"># Create a my.cnf file that you can use to test the certificates</span>
<span class="token comment" spellcheck="true">#</span>
cat <<EOF > $DIR/my<span class="token punctuation">.</span>cnf
<span class="token punctuation">[</span>client<span class="token punctuation">]</span>
ssl<span class="token constant">-ca</span><span class="token attr-value"><span class="token punctuation">=</span>$DIR/ca.pem</span>
ssl<span class="token constant">-cert</span><span class="token attr-value"><span class="token punctuation">=</span>$DIR/client-cert.pem</span>
ssl<span class="token constant">-key</span><span class="token attr-value"><span class="token punctuation">=</span>$DIR/client-key.pem</span>
<span class="token punctuation">[</span>mysqld<span class="token punctuation">]</span>
ssl_ca<span class="token attr-value"><span class="token punctuation">=</span>$DIR/ca.pem</span>
ssl_cert<span class="token attr-value"><span class="token punctuation">=</span>$DIR/server-cert.pem</span>
ssl_key<span class="token attr-value"><span class="token punctuation">=</span>$DIR/server-key.pem</span>
EOF</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="creating-ssl-files-using-openssl-windows">
</a>
Example 3: Creating SSL Files on Windows
</h5>
</div>
</div>
</div>
<p>
Download OpenSSL for Windows if it is not installed on your
system. An overview of available packages can be seen here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa18995837"><div class="copy-help left">Press ⌘+C to 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">http://www.slproweb.com/products/Win32OpenSSL.html</code></pre>
</div>
<p>
Choose the Win32 OpenSSL Light or Win64 OpenSSL Light package,
depending on your architecture (32-bit or 64-bit). The default
installation location is
<code class="literal">
C:\OpenSSL-Win32
</code>
or
<code class="literal">
C:\OpenSSL-Win64
</code>
, depending on which
package you downloaded. The following instructions assume a
default location of
<code class="literal">
C:\OpenSSL-Win32
</code>
.
Modify this as necessary if you are using the 64-bit package.
</p>
<p>
If a message occurs during setup indicating
<code class="literal">
'...critical component is missing: Microsoft Visual
C++ 2019 Redistributables'
</code>
, cancel the setup and
download one of the following packages as well, again
depending on your architecture (32-bit or 64-bit):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Visual C++ 2008 Redistributables (x86), available at:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa79668335"><div class="copy-help left">Press ⌘+C to 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">http://www.microsoft.com/downloads/details.aspx?familyid</span><span class="token attr-value"><span class="token punctuation">=</span>9B2DA534-3E03-4391-8A4D-074B9F2BC1BF</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Visual C++ 2008 Redistributables (x64), available at:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa99928952"><div class="copy-help left">Press ⌘+C to 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">http://www.microsoft.com/downloads/details.aspx?familyid</span><span class="token attr-value"><span class="token punctuation">=</span>bd2a6171-e2d6-4230-b809-9a8d7548c1b6</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
After installing the additional package, restart the OpenSSL
setup procedure.
</p>
<p>
During installation, leave the default
<code class="filename">
C:\OpenSSL-Win32
</code>
as the install path, and
also leave the default option
<code class="literal">
'Copy OpenSSL DLL files
to the Windows system directory'
</code>
selected.
</p>
<p>
When the installation has finished, add
<code class="filename">
C:\OpenSSL-Win32\bin
</code>
to the Windows
System Path variable of your server (depending on your version
of Windows, the following path-setting instructions might
differ slightly):
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the Windows desktop, right-click the
<span class="guiicon">
My
Computer
</span>
icon, and select
<span class="guimenuitem">
Properties
</span>
.
</p>
</li>
<li class="listitem">
<p>
Select the
<span class="guimenuitem">
Advanced
</span>
tab from
the
<span class="guimenu">
System Properties
</span>
menu that
appears, and click the
<span class="guibutton">
Environment
Variables
</span>
button.
</p>
</li>
<li class="listitem">
<p>
Under
<span class="guilabel">
System Variables
</span>
, select
<span class="guimenuitem">
Path
</span>
, then click the
<span class="guibutton">
Edit
</span>
button. The
<span class="guimenu">
Edit
System Variable
</span>
dialogue should appear.
</p>
</li>
<li class="listitem">
<p>
Add
<code class="literal">
';C:\OpenSSL-Win32\bin'
</code>
to the end
(notice the semicolon).
</p>
</li>
<li class="listitem">
<p>
Press OK 3 times.
</p>
</li>
<li class="listitem">
<p>
Check that OpenSSL was correctly integrated into the Path
variable by opening a new command console
(
<span class="command">
<strong>
Start>Run>cmd.exe
</strong>
</span>
) and verifying
that OpenSSL is available:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18764222"><div class="copy-help left">Press ⌘+C to 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">Microsoft Windows <span class="token punctuation">[</span>Version <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
Copyright <span class="token punctuation">(</span>c<span class="token punctuation">)</span> 2006 Microsoft Corporation<span class="token punctuation">.</span> All rights reserved<span class="token punctuation">.</span>
<span class="token prompt">C:\Windows\system32></span><span class="token command">cd</span> \
<span class="token prompt">C:\></span><span class="token command">openssl</span>
OpenSSL> exit <<< If you see the OpenSSL prompt<span class="token punctuation">,</span> installation was successful<span class="token punctuation">.</span>
<span class="token prompt">C:\></span></code></pre>
</div>
</li>
</ol>
</div>
<p>
After OpenSSL has been installed, use instructions similar to
those from Example 1 (shown earlier in this section), with the
following changes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Change the following Unix commands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa64563745"><div class="copy-help left">Press ⌘+C to 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 comment" spellcheck="true"># Create clean environment</span>
rm <span class="token property">-rf</span> newcerts
mkdir newcerts && cd newcerts</code></pre>
</div>
<p>
On Windows, use these commands instead:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa12249083"><div class="copy-help left">Press ⌘+C to 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 comment" spellcheck="true"># Create clean environment</span>
md c<span class="token punctuation">:</span>\newcerts
cd c<span class="token punctuation">:</span>\newcerts</code></pre>
</div>
</li>
<li class="listitem">
<p>
When a
<code class="literal">
'\'
</code>
character is shown at the
end of a command line, this
<code class="literal">
'\'
</code>
character must be removed and the command lines entered
all on a single line.
</p>
</li>
</ul>
</div>
<p>
After generating the certificate and key files, to use them
for SSL connections, see
<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>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-session.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-session">
</a>
30.4.3.33 The session and x$session Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062254448">
</a>
<a class="indexterm" name="idm46045062252992">
</a>
<a class="indexterm" name="idm46045062251504">
</a>
<a class="indexterm" name="idm46045062250016">
</a>
<p>
These views are similar to
<a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
<code class="literal">
processlist
</code>
</a>
and
<a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
<code class="literal">
x$processlist
</code>
</a>
, but they filter
out background processes to display only user sessions. For
descriptions of the columns, see
<a class="xref" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
Section 30.4.3.22, “The processlist and x$processlist Views”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connecting.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="connecting">
</a>
6.2.4 Connecting to the MySQL Server Using Command Options
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045322804224">
</a>
<a class="indexterm" name="idm46045322802768">
</a>
<a class="indexterm" name="idm46045322801696">
</a>
<a class="indexterm" name="idm46045322800208">
</a>
<a class="indexterm" name="idm46045322798720">
</a>
<a class="indexterm" name="idm46045322797648">
</a>
<a class="indexterm" name="idm46045322796576">
</a>
<p>
This section describes use of command-line options to specify how
to establish connections to the MySQL server, for clients 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>
or
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
. For
information on establishing connections using URI-like connection
strings or key-value pairs, for clients such as MySQL Shell, see
<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>
. For
additional information if you are unable to connect, see
<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>
.
</p>
<p>
For a client program to connect to the MySQL server, it must use
the proper connection parameters, such as the name of the host
where the server is running and the user name and password of your
MySQL account. Each connection parameter has a default value, but
you can override default values as necessary using program options
specified either on the command line or in an option file.
</p>
<p>
The examples here use 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,
but the principles apply to other clients 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>
,
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
, or
<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>
.
</p>
<p>
This command invokes
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
without specifying
any explicit connection parameters:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa11262802"><div class="copy-help left">Press ⌘+C to 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">mysql</code></pre>
</div>
<p>
Because there are no parameter options, the default values apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The default host name is
<code class="literal">
localhost
</code>
. On
Unix, this has a special meaning, as described later.
</p>
</li>
<li class="listitem">
<p>
The default user name is
<code class="literal">
ODBC
</code>
on Windows or
your Unix login name on Unix.
</p>
</li>
<li class="listitem">
<p>
No password is sent because neither
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
nor
<code class="option">
-p
</code>
is given.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, the first nonoption argument is
taken as the name of the default database. Because there is no
such argument,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
selects no default
database.
</p>
</li>
</ul>
</div>
<p>
To specify the host name and user name explicitly, as well as a
password, supply appropriate options on the command line. To
select a default database, add a database-name argument. Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68706255"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>localhost</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>myname</span> <span class="token constant">--password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">password</em></span> mydb
mysql <span class="token property">-h</span> localhost <span class="token property">-u</span> myname <span class="token property">-p<em class="replaceable">password</em></span> mydb</code></pre>
</div>
<p>
For password options, the password value is optional:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you use a
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
or
<code class="option">
-p
</code>
option and specify a password value, there
must be
<span class="emphasis">
<em>
no space
</em>
</span>
between
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password=
</code>
</a>
or
<code class="option">
-p
</code>
and the password following it.
</p>
</li>
<li class="listitem">
<p>
If you use
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
or
<code class="option">
-p
</code>
but do not specify a password value, the
client program prompts you to enter the password. The password
is not displayed as you enter it. This is more secure than
giving the password on the command line, which might enable
other users on your system to see the password line by
executing a command such as
<span class="command">
<strong>
ps
</strong>
</span>
. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
To explicitly specify that there is no password and that the
client program should not prompt for one, use the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--skip-password
</code>
</a>
option.
</p>
</li>
</ul>
</div>
<p>
As just mentioned, including the password value on the command
line is a security risk. To avoid this risk, specify the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
or
<code class="option">
-p
</code>
option without any following password value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa75330406"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>localhost</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>myname</span> <span class="token property">--password</span> mydb
mysql <span class="token property">-h</span> localhost <span class="token property">-u</span> myname <span class="token property">-p</span> mydb</code></pre>
</div>
<p>
When the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
or
<code class="option">
-p
</code>
option is given with no password value, the
client program prints a prompt and waits for you to enter the
password. (In these examples,
<code class="literal">
mydb
</code>
is
<span class="emphasis">
<em>
not
</em>
</span>
interpreted as a password because it is
separated from the preceding password option by a space.)
</p>
<p>
On some systems, the library routine that MySQL uses to prompt for
a password automatically limits the password to eight characters.
That limitation is a property of the system library, not MySQL.
Internally, MySQL does not have any limit for the length of the
password. To work around the limitation on systems affected by it,
specify your password in an option file (see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
). Another workaround is to change
your MySQL password to a value that has eight or fewer characters,
but that has the disadvantage that shorter passwords tend to be
less secure.
</p>
<p>
Client programs determine what type of connection to make as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the host is not specified or is
<code class="literal">
localhost
</code>
, a connection to the local host
occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
On Windows, the client connects using shared memory, if
the server was started with the
<a class="link" href="server-system-variables.html#sysvar_shared_memory">
<code class="literal">
shared_memory
</code>
</a>
system
variable enabled to support shared-memory connections.
</p>
</li>
<li class="listitem">
<p>
On Unix, MySQL programs treat the host name
<code class="literal">
localhost
</code>
specially, in a way that is
likely different from what you expect compared to other
network-based programs: the client connects using a Unix
socket file. The
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
option or the
<code class="literal">
MYSQL_UNIX_PORT
</code>
environment variable may be used to specify the socket
name.
</p>
<a class="indexterm" name="idm46045322742832">
</a>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
On Windows, if
<code class="literal">
host
</code>
is
<code class="literal">
.
</code>
(period), or TCP/IP is not enabled and
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
is not specified or
the host is empty, the client connects using a named pipe, if
the server was started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable
enabled to support named-pipe connections. If named-pipe
connections are not supported or if the user making the
connection is not a member of the Windows group specified by
the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable, an error occurs.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the connection uses TCP/IP.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol
</code>
</a>
option enables you
to use a particular transport protocol even when other options
normally result in use of a different protocol. That is,
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol
</code>
</a>
specifies the transport
protocol explicitly and overrides the preceding rules, even for
<code class="literal">
localhost
</code>
.
</p>
<p>
Only connection options that are relevant to the selected
transport protocol are used or checked. Other connection options
are ignored. For example, with
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host=localhost
</code>
</a>
on Unix, the
client attempts to connect to the local server using a Unix socket
file, even if a
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port
</code>
</a>
or
<code class="option">
-P
</code>
option is given to specify a TCP/IP port
number.
</p>
<p>
To ensure that the client makes a TCP/IP connection to the local
server, use
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host
</code>
</a>
or
<code class="option">
-h
</code>
to specify a host name value of
<code class="literal">
127.0.0.1
</code>
(instead of
<code class="literal">
localhost
</code>
), or the IP address or name of the
local server. You can also specify the transport protocol
explicitly, even for
<code class="literal">
localhost
</code>
, by using the
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol=TCP
</code>
</a>
option. Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa274116"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
mysql <span class="token constant">--protocol</span><span class="token attr-value"><span class="token punctuation">=</span>TCP</span></code></pre>
</div>
<p>
If the server is configured to accept IPv6 connections, clients
can connect to the local server over IPv6 using
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host=::1
</code>
</a>
. See
<a class="xref" href="ipv6-support.html" title="7.1.13 IPv6 Support">
Section 7.1.13, “IPv6 Support”
</a>
.
</p>
<p>
On Windows, to force a MySQL client to use a named-pipe
connection, specify the
<a class="link" href="connection-options.html#option_general_pipe">
<code class="option">
--pipe
</code>
</a>
or
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol=PIPE
</code>
</a>
option, or specify
<code class="literal">
.
</code>
(period) as the host name. If the server was
not started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable enabled to support named-pipe connections or if
the user making the connection is not a member of the Windows
group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable, an error occurs. Use the
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
option to specify the
name of the pipe if you do not want to use the default pipe name.
</p>
<p>
Connections to remote servers use TCP/IP. This command connects to
the server running on
<code class="literal">
remote.example.com
</code>
using
the default port number (3306):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa3982935"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>remote.example.com</span></code></pre>
</div>
<p>
To specify a port number explicitly, use the
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port
</code>
</a>
or
<code class="option">
-P
</code>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa47601944"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>remote.example.com</span> <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>13306</span></code></pre>
</div>
<p>
You can specify a port number for connections to a local server,
too. However, as indicated previously, connections to
<code class="literal">
localhost
</code>
on Unix use a socket file by default,
so unless you force a TCP/IP connection as previously described,
any option that specifies a port number is ignored.
</p>
<p>
For this command, the program uses a socket file on Unix and the
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port
</code>
</a>
option is ignored:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa39741887"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>13306</span> <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>localhost</span></code></pre>
</div>
<p>
To cause the port number to be used, force a TCP/IP connection.
For example, invoke the program in either of these ways:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa84693728"><div class="copy-help left">Press ⌘+C to 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">mysql <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>13306</span> <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
mysql <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>13306</span> <span class="token constant">--protocol</span><span class="token attr-value"><span class="token punctuation">=</span>TCP</span></code></pre>
</div>
<p>
For additional information about options that control how client
programs establish connections to the server, see
<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>
.
</p>
<p>
It is possible to specify connection parameters without entering
them on the command line each time you invoke a client program:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Specify the connection parameters in the
<code class="literal">
[client]
</code>
section of an option file. The
relevant section of the file might look like this:
</p>
<a class="indexterm" name="idm46045322698032">
</a>
<a class="indexterm" name="idm46045322696960">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa49959204"><div class="copy-help left">Press ⌘+C to 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">[client]</span>
<span class="token constant">host</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">host_name</em></span>
<span class="token constant">user</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">user_name</em></span>
<span class="token constant">password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">password</em></span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Some connection parameters can be specified using environment
variables. Examples:
</p>
<a class="indexterm" name="idm46045322691232">
</a>
<a class="indexterm" name="idm46045322690144">
</a>
<a class="indexterm" name="idm46045322688656">
</a>
<a class="indexterm" name="idm46045322687568">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
To specify the host for
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, use
<code class="literal">
MYSQL_HOST
</code>
.
</p>
</li>
<li class="listitem">
<p>
On Windows, to specify the MySQL user name, use
<code class="literal">
USER
</code>
.
</p>
</li>
</ul>
</div>
<p>
For a list of supported environment variables, see
<a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
Section 6.9, “Environment Variables”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fixed-point-types.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fixed-point-types">
</a>
13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC
</h3>
</div>
</div>
</div>
<p>
The
<code class="literal">
DECIMAL
</code>
and
<code class="literal">
NUMERIC
</code>
types store exact numeric data values. These types are used when
it is important to preserve exact precision, for example with
monetary data. In MySQL,
<code class="literal">
NUMERIC
</code>
is
implemented as
<code class="literal">
DECIMAL
</code>
, so the following
remarks about
<code class="literal">
DECIMAL
</code>
apply equally to
<code class="literal">
NUMERIC
</code>
.
</p>
<p>
MySQL stores
<code class="literal">
DECIMAL
</code>
values in binary format.
See
<a class="xref" href="precision-math.html" title="14.24 Precision Math">
Section 14.24, “Precision Math”
</a>
.
</p>
<p>
In a
<code class="literal">
DECIMAL
</code>
column declaration, the
precision and scale can be (and usually is) specified. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa56413198"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">salary <span class="token datatype">DECIMAL</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
In this example,
<code class="literal">
5
</code>
is the precision and
<code class="literal">
2
</code>
is the scale. The precision represents the
number of significant digits that are stored for values, and the
scale represents the number of digits that can be stored
following the decimal point.
</p>
<p>
Standard SQL requires that
<code class="literal">
DECIMAL(5,2)
</code>
be
able to store any value with five digits and two decimals, so
values that can be stored in the
<code class="literal">
salary
</code>
column range from
<code class="literal">
-999.99
</code>
to
<code class="literal">
999.99
</code>
.
</p>
<p>
In standard SQL, the syntax
<code class="literal">
DECIMAL(
<em class="replaceable">
<code>
M
</code>
</em>
)
</code>
is
equivalent to
<code class="literal">
DECIMAL(
<em class="replaceable">
<code>
M
</code>
</em>
,0)
</code>
.
Similarly, the syntax
<code class="literal">
DECIMAL
</code>
is equivalent
to
<code class="literal">
DECIMAL(
<em class="replaceable">
<code>
M
</code>
</em>
,0)
</code>
,
where the implementation is permitted to decide the value of
<em class="replaceable">
<code>
M
</code>
</em>
. MySQL supports both of these
variant forms of
<code class="literal">
DECIMAL
</code>
syntax. The default
value of
<em class="replaceable">
<code>
M
</code>
</em>
is 10.
</p>
<p>
If the scale is 0,
<code class="literal">
DECIMAL
</code>
values contain no
decimal point or fractional part.
</p>
<p>
The maximum number of digits for
<code class="literal">
DECIMAL
</code>
is
65, but the actual range for a given
<code class="literal">
DECIMAL
</code>
column can be constrained by the precision or scale for a given
column. When such a column is assigned a value with more digits
following the decimal point than are permitted by the specified
scale, the value is converted to that scale. (The precise
behavior is operating system-specific, but generally the effect
is truncation to the permissible number of digits.)
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-databases.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-databases">
</a>
15.7.7.15 SHOW DATABASES Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170734112">
</a>
<a class="indexterm" name="idm46045170733056">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69204003"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DATABASES</span> <span class="token operator">|</span> <span class="token keyword">SCHEMAS</span>}
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">pattern</em>'</span> <span class="token operator">|</span> <span class="token keyword">WHERE</span> <em class="replaceable">expr</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW DATABASES
</code>
</a>
lists the
databases on the MySQL server host.
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW
SCHEMAS
</code>
</a>
is a synonym for
<a class="link" href="show-databases.html" title="15.7.7.15 SHOW DATABASES Statement">
<code class="literal">
SHOW
DATABASES
</code>
</a>
. The
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
clause, if present, indicates which database names to match. The
<code class="literal">
WHERE
</code>
clause can be given to select rows
using more general conditions, as discussed in
<a class="xref" href="extended-show.html" title="28.8 Extensions to SHOW Statements">
Section 28.8, “Extensions to SHOW Statements”
</a>
.
</p>
<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. You can also get this list using
the
<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>
command.
</p>
<p>
If the server was started with the
<a class="link" href="server-options.html#option_mysqld_skip-show-database">
<code class="option">
--skip-show-database
</code>
</a>
option, you
cannot use this statement at all unless you have the
<a class="link" href="privileges-provided.html#priv_show-databases">
<code class="literal">
SHOW DATABASES
</code>
</a>
privilege.
</p>
<p>
MySQL implements databases as directories in the data directory,
so this statement simply lists directories in that location.
However, the output may include names of directories that do not
correspond to actual databases.
</p>
<p>
Database information is also available from the
<code class="literal">
INFORMATION_SCHEMA
</code>
<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. See
<a class="xref" href="information-schema-schemata-table.html" title="28.3.31 The INFORMATION_SCHEMA SCHEMATA Table">
Section 28.3.31, “The INFORMATION_SCHEMA SCHEMATA Table”
</a>
.
</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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-table-constraints-extensions-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-table-constraints-extensions-table">
</a>
28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045078231216">
</a>
<p>
The
<a class="link" href="information-schema-table-constraints-extensions-table.html" title="28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table">
<code class="literal">
TABLE_CONSTRAINTS_EXTENSIONS
</code>
</a>
table provides information about table constraint attributes
defined for primary and secondary storage engines.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="information-schema-table-constraints-extensions-table.html" title="28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table">
<code class="literal">
TABLE_CONSTRAINTS_EXTENSIONS
</code>
</a>
table is reserved for future use.
</p>
</div>
<p>
The
<a class="link" href="information-schema-table-constraints-extensions-table.html" title="28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table">
<code class="literal">
TABLE_CONSTRAINTS_EXTENSIONS
</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">
CONSTRAINT_CATALOG
</code>
</p>
<p>
The name of the catalog to which the table belongs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CONSTRAINT_SCHEMA
</code>
</p>
<p>
The name of the schema (database) to which the table belongs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CONSTRAINT_NAME
</code>
</p>
<p>
The name of the constraint.
</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">
ENGINE_ATTRIBUTE
</code>
</p>
<p>
Constraint attributes defined for the primary storage engine.
Reserved for future use.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SECONDARY_ENGINE_ATTRIBUTE
</code>
</p>
<p>
Constraint attributes defined for the secondary storage
engine. Reserved for future use.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-class-geometry.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gis-class-geometry">
</a>
13.4.2.2 Geometry Class
</h4>
</div>
</div>
</div>
<p>
<code class="literal">
Geometry
</code>
is the root class of the
hierarchy. It is a noninstantiable class but has a number of
properties, described in the following list, that are common
to all geometry values created from any of the
<code class="literal">
Geometry
</code>
subclasses. Particular subclasses
have their own specific properties, described later.
</p>
<p>
<span class="bold">
<strong>
Geometry Properties
</strong>
</span>
</p>
<p>
A geometry value has the following properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
type
</strong>
</span>
. Each geometry
belongs to one of the instantiable classes in the
hierarchy.
</p>
</li>
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
SRID
</strong>
</span>
, or spatial
reference identifier. This value identifies the geometry's
associated spatial reference system that describes the
coordinate space in which the geometry object is defined.
</p>
<p>
In MySQL, the SRID value is an integer associated with the
geometry value. The maximum usable SRID value is
2
<sup>
32
</sup>
−1. If a larger value
is given, only the lower 32 bits are used.
</p>
<p>
SRID 0 represents an infinite flat Cartesian plane with no
units assigned to its axes. To ensure SRID 0 behavior,
create geometry values using SRID 0. SRID 0 is the default
for new geometry values if no SRID is specified.
</p>
<p>
For computations on multiple geometry values, all values
must have the same SRID or an error occurs.
</p>
</li>
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
coordinates
</strong>
</span>
in its
spatial reference system, represented as double-precision
(8-byte) numbers. All nonempty geometries include at least
one pair of (X,Y) coordinates. Empty geometries contain no
coordinates.
</p>
<p>
Coordinates are related to the SRID. For example, in
different coordinate systems, the distance between two
objects may differ even when objects have the same
coordinates, because the distance on the
<span class="bold">
<strong>
planar
</strong>
</span>
coordinate system
and the distance on the
<span class="bold">
<strong>
geodetic
</strong>
</span>
system
(coordinates on the Earth's surface) are different things.
</p>
</li>
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
interior
</strong>
</span>
,
<span class="bold">
<strong>
boundary
</strong>
</span>
, and
<span class="bold">
<strong>
exterior
</strong>
</span>
.
</p>
<p>
Every geometry occupies some position in space. The
exterior of a geometry is all space not occupied by the
geometry. The interior is the space occupied by the
geometry. The boundary is the interface between the
geometry's interior and exterior.
</p>
</li>
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
MBR
</strong>
</span>
(minimum bounding
rectangle), or envelope. This is the bounding geometry,
formed by the minimum and maximum (X,Y) coordinates:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa43158334"><div class="copy-help left">Press ⌘+C to 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><span class="token punctuation">(</span>MINX MINY<span class="token punctuation">,</span> MAXX MINY<span class="token punctuation">,</span> MAXX MAXY<span class="token punctuation">,</span> MINX MAXY<span class="token punctuation">,</span> MINX MINY<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Whether the value is
<span class="bold">
<strong>
simple
</strong>
</span>
or
<span class="bold">
<strong>
nonsimple
</strong>
</span>
. Geometry
values of types (
<code class="literal">
LineString
</code>
,
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
MultiLineString
</code>
) are either simple or
nonsimple. Each type determines its own assertions for
being simple or nonsimple.
</p>
</li>
<li class="listitem">
<p>
Whether the value is
<span class="bold">
<strong>
closed
</strong>
</span>
or
<span class="bold">
<strong>
not closed
</strong>
</span>
. Geometry
values of types (
<code class="literal">
LineString
</code>
,
<code class="literal">
MultiString
</code>
) are either closed or not
closed. Each type determines its own assertions for being
closed or not closed.
</p>
</li>
<li class="listitem">
<p>
Whether the value is
<span class="bold">
<strong>
empty
</strong>
</span>
or
<span class="bold">
<strong>
nonempty
</strong>
</span>
A geometry is
empty if it does not have any points. Exterior, interior,
and boundary of an empty geometry are not defined (that
is, they are represented by a
<code class="literal">
NULL
</code>
value). An empty geometry is defined to be always simple
and has an area of 0.
</p>
</li>
<li class="listitem">
<p>
Its
<span class="bold">
<strong>
dimension
</strong>
</span>
. A geometry
can have a dimension of −1, 0, 1, or 2:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
−1 for an empty geometry.
</p>
</li>
<li class="listitem">
<p>
0 for a geometry with no length and no area.
</p>
</li>
<li class="listitem">
<p>
1 for a geometry with nonzero length and zero area.
</p>
</li>
<li class="listitem">
<p>
2 for a geometry with nonzero area.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
Point
</code>
objects have a dimension of zero.
<code class="literal">
LineString
</code>
objects have a dimension of
1.
<code class="literal">
Polygon
</code>
objects have a dimension of
2. The dimensions of
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
MultiLineString
</code>
, and
<code class="literal">
MultiPolygon
</code>
objects are the same as
the dimensions of the elements they consist of.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/perl-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="perl-installation">
</a>
2.10.1 Installing Perl on Unix
</h3>
</div>
</div>
</div>
<p>
MySQL Perl support requires that you have installed MySQL client
programming support (libraries and header files). Most
installation methods install the necessary files. If you install
MySQL from RPM files on Linux, be sure to install the developer
RPM as well. The client programs are in the client RPM, but client
programming support is in the developer RPM.
</p>
<p>
The files you need for Perl support can be obtained from the CPAN
(Comprehensive Perl Archive Network) at
<a class="ulink" href="http://search.cpan.org" target="_blank">
http://search.cpan.org
</a>
.
</p>
<p>
The easiest way to install Perl modules on Unix is to use the
<code class="literal">
CPAN
</code>
module. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa91314699"><div class="copy-help left">Press ⌘+C to 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">perl</span> <span class="token property">-MCPAN</span> <span class="token property">-e</span> shell
cpan> install DBI
cpan> install DBD<span class="token punctuation">:</span><span class="token punctuation">:</span>mysql</code></pre>
</div>
<p>
The
<code class="literal">
DBD::mysql
</code>
installation runs a number of
tests. These tests attempt to connect to the local MySQL server
using the default user name and password. (The default user name
is your login name on Unix, and
<code class="literal">
ODBC
</code>
on
Windows. The default password is
<span class="quote">
“
<span class="quote">
no password.
</span>
”
</span>
) If
you cannot connect to the server with those values (for example,
if your account has a password), the tests fail. You can use
<code class="literal">
force install DBD::mysql
</code>
to ignore the failed
tests.
</p>
<p>
<code class="literal">
DBI
</code>
requires the
<code class="literal">
Data::Dumper
</code>
module. It may be installed; if
not, you should install it before installing
<code class="literal">
DBI
</code>
.
</p>
<p>
It is also possible to download the module distributions in the
form of compressed
<span class="command">
<strong>
tar
</strong>
</span>
archives and build the
modules manually. For example, to unpack and build a DBI
distribution, use a procedure such as this:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Unpack the distribution into the current directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa10868672"><div class="copy-help left">Press ⌘+C to 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">gunzip</span> < DBI-<em class="replaceable">VERSION</em><span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz | tar xvf -</code></pre>
</div>
<p>
This command creates a directory named
<code class="filename">
DBI-
<em class="replaceable">
<code>
VERSION
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
Change location into the top-level directory of the unpacked
distribution:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa41663309"><div class="copy-help left">Press ⌘+C to 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> DBI-<em class="replaceable">VERSION</em></code></pre>
</div>
</li>
<li class="listitem">
<p>
Build the distribution and compile everything:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68837616"><div class="copy-help left">Press ⌘+C to 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">perl</span> Makefile<span class="token punctuation">.</span>PL
<span class="token prompt">$> </span><span class="token command">make</span>
<span class="token prompt">$> </span><span class="token command">make</span> test
<span class="token prompt">$> </span><span class="token command">make</span> install</code></pre>
</div>
</li>
</ol>
</div>
<p>
The
<span class="command">
<strong>
make test
</strong>
</span>
command is important because it
verifies that the module is working. Note that when you run that
command during the
<code class="literal">
DBD::mysql
</code>
installation to
exercise the interface code, the MySQL server must be running or
the test fails.
</p>
<p>
It is a good idea to rebuild and reinstall the
<code class="literal">
DBD::mysql
</code>
distribution whenever you install a
new release of MySQL. This ensures that the latest versions of the
MySQL client libraries are installed correctly.
</p>
<p>
If you do not have access rights to install Perl modules in the
system directory or if you want to install local Perl modules, the
following reference may be useful:
<a class="ulink" href="http://learn.perl.org/faq/perlfaq8.html#How-do-I-keep-my-own-module-library-directory-" target="_blank">
http://learn.perl.org/faq/perlfaq8.html#How-do-I-keep-my-own-module-library-directory-
</a>
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/windows-initialize-data-directory.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="windows-initialize-data-directory">
</a>
2.3.3.4 Initializing the Data Directory
</h4>
</div>
</div>
</div>
<p>
If you installed MySQL using the
<code class="literal">
noinstall
</code>
package, no data directory is included. To initialize the data
directory, use the instructions at
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-move-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-move-data">
</a>
25.5.15 ndb_move_data — NDB Data Copy Utility
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045101195824">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html" title="25.5.15 ndb_move_data — NDB Data Copy Utility">
<span class="command">
<strong>
ndb_move_data
</strong>
</span>
</a>
copies data from one NDB table
to another.
</p>
<h4>
<a name="idm46045101192992">
</a>
Usage
</h4>
<p>
The program is invoked with the names of the source and target
tables; either or both of these may be qualified optionally with
the database name. Both tables must use the NDB storage engine.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa74101683"><div class="copy-help left">Press ⌘+C to 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">ndb_move_data <em class="replaceable">options</em> <em class="replaceable">source</em> <em class="replaceable">target</em></code></pre>
</div>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-move-data.html" title="25.5.15 ndb_move_data — NDB Data Copy Utility">
<span class="command">
<strong>
ndb_move_data
</strong>
</span>
</a>
are shown in the following table. Additional descriptions follow
the table.
</p>
<p>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ndb_move_data_abort-on-error">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_abort-on-error">
<code class="option">
--abort-on-error
</code>
</a>
</p>
<a class="indexterm" name="idm46045101184704">
</a>
<a class="indexterm" name="idm46045101183216">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for abort-on-error">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--abort-on-error
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Dump core on permanent error (debug option).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
=
<em class="replaceable">
<code>
name
</code>
</em>
</p>
<a class="indexterm" name="idm46045101173024">
</a>
<a class="indexterm" name="idm46045101171568">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Directory where character sets are.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045101157200">
</a>
<a class="indexterm" name="idm46045101155696">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retry-delay">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retry-delay=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of seconds to wait between attempts to contact
management server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045101136512">
</a>
<a class="indexterm" name="idm46045101135024">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retries">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retries=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of times to retry connection before giving up.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045101116000">
</a>
<a class="indexterm" name="idm46045101114512">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-string">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-string=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045101099264">
</a>
<a class="indexterm" name="idm46045101097776">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for core-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--core-file
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Write core file on error; used in debugging.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_database">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_database">
<code class="option">
--database
</code>
</a>
=
<em class="replaceable">
<code>
dbname
</code>
</em>
,
<code class="option">
-d
</code>
</p>
<a class="indexterm" name="idm46045101087216">
</a>
<a class="indexterm" name="idm46045101085728">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--database=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
TEST_DB
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Name of the database in which the table is found.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045101071440">
</a>
<a class="indexterm" name="idm46045101069936">
</a>
<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=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given file after global files are read.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045101055712">
</a>
<a class="indexterm" name="idm46045101054224">
</a>
<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=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read default options from given file only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045101039872">
</a>
<a class="indexterm" name="idm46045101038368">
</a>
<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=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Also read groups with concat(group, suffix).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_drop-source">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_drop-source">
<code class="option">
--drop-source
</code>
</a>
</p>
<a class="indexterm" name="idm46045101024144">
</a>
<a class="indexterm" name="idm46045101022656">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for drop-source">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--drop-source
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Drop source table after all rows have been moved.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_error-insert">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_error-insert">
<code class="option">
--error-insert
</code>
</a>
</p>
<a class="indexterm" name="idm46045101012864">
</a>
<a class="indexterm" name="idm46045101011376">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for error-insert">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--error-insert
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Insert random temporary errors (testing option).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_exclude-missing-columns">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_exclude-missing-columns">
<code class="option">
--exclude-missing-columns
</code>
</a>
</p>
<a class="indexterm" name="idm46045101001552">
</a>
<a class="indexterm" name="idm46045101000048">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-missing-columns">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-missing-columns
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Ignore extra columns in source or target table.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045100990320">
</a>
<a class="indexterm" name="idm46045100988832">
</a>
<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>
<p>
Display help text and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045100979152">
</a>
<a class="indexterm" name="idm46045100977664">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given path from login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045100963392">
</a>
<a class="indexterm" name="idm46045100961904">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Skips reading options from the login path file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_lossy-conversions">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_lossy-conversions">
<code class="option">
--lossy-conversions
</code>
</a>
,
<code class="option">
-l
</code>
</p>
<a class="indexterm" name="idm46045100951760">
</a>
<a class="indexterm" name="idm46045100950304">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for lossy-conversions">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--lossy-conversions
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Allow attribute data to be truncated when converted to a
smaller type.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045100940592">
</a>
<a class="indexterm" name="idm46045100939136">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-connectstring">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-connectstring=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set connection string for connecting to
<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>
. Syntax:
<code class="literal">
[nodeid=
<em class="replaceable">
<code>
id
</code>
</em>
;][host=]
<em class="replaceable">
<code>
hostname
</code>
</em>
[:
<em class="replaceable">
<code>
port
</code>
</em>
]
</code>
.
Overrides entries in
<code class="literal">
NDB_CONNECTSTRING
</code>
and
<code class="filename">
my.cnf
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045100920096">
</a>
<a class="indexterm" name="idm46045100918608">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgm-tls">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgm-tls=level
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
relaxed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
relaxed
</code>
</p>
<p class="valid-value">
<code class="literal">
strict
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the level of TLS support required to connect to the
management server; one of
<code class="literal">
relaxed
</code>
or
<code class="literal">
strict
</code>
.
<code class="literal">
relaxed
</code>
(the
default) means that a TLS connection is attempted, but
success is not required;
<code class="literal">
strict
</code>
means
that TLS is required to connect.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045100897552">
</a>
<a class="indexterm" name="idm46045100896064">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgmd-host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgmd-host=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045100880816">
</a>
<a class="indexterm" name="idm46045100879328">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-nodeid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-nodeid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set node ID for this node, overriding any ID set by
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045100864016">
</a>
<a class="indexterm" name="idm46045100862512">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-optimized-node-selection">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-optimized-node-selection
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Enable optimizations for selection of nodes for
transactions. Enabled by default; use
<code class="option">
--skip-ndb-optimized-node-selection
</code>
to
disable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045100852016">
</a>
<a class="indexterm" name="idm46045100850512">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-tls-search-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-tls-search-path=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Path name
</td>
</tr>
<tr>
<th>
Default Value (Unix)
</th>
<td>
<code class="literal">
$HOME/ndb-tls
</code>
</td>
</tr>
<tr>
<th>
Default Value (Windows)
</th>
<td>
<code class="literal">
$HOMEDIR/ndb-tls
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify a list of directories to search for a CA file. On
Unix platforms, the directory names are separated by colons
(
<code class="literal">
:
</code>
); on Windows systems, the semicolon
character (
<code class="literal">
;
</code>
) is used as the separator. A
directory reference may be relative or absolute; it may
contain one or more environment variables, each denoted by a
prefixed dollar sign (
<code class="literal">
$
</code>
), and expanded
prior to use.
</p>
<p>
Searching begins with the leftmost named directory and
proceeds from left to right until a file is found. An empty
string denotes an empty search path, which causes all
searches to fail. A string consisting of a single dot
(
<code class="literal">
.
</code>
) indicates that the search path
limited to the current working directory.
</p>
<p>
If no search path is supplied, the compiled-in default value
is used. This value depends on the platform used: On
Windows, this is
<code class="literal">
\ndb-tls
</code>
; on other
platforms (including Linux), it is
<code class="literal">
$HOME/ndb-tls
</code>
. This can be overridden by
compiling NDB Cluster using
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb_tls_search_path">
<code class="option">
-DWITH_NDB_TLS_SEARCH_PATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045100826752">
</a>
<a class="indexterm" name="idm46045100825264">
</a>
<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>
<p>
Do not read default options from any option file other than
login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045100815440">
</a>
<a class="indexterm" name="idm46045100813952">
</a>
<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>
<p>
Print program argument list and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_promote-attributes">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_promote-attributes">
<code class="option">
--promote-attributes
</code>
</a>
,
<code class="option">
-A
</code>
</p>
<a class="indexterm" name="idm46045100803760">
</a>
<a class="indexterm" name="idm46045100802304">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for promote-attributes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--promote-attributes
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Allow attribute data to be converted to a larger type.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_staging-tries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_staging-tries">
<code class="option">
--staging-tries
</code>
</a>
=
<em class="replaceable">
<code>
x[,y[,z]]
</code>
</em>
</p>
<a class="indexterm" name="idm46045100791968">
</a>
<a class="indexterm" name="idm46045100790480">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for staging-tries">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--staging-tries=x[,y[,z]]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0,1000,60000
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify tries on temporary errors. Format is x[,y[,z]] where
x=max tries (0=no limit), y=min delay (ms), z=max delay
(ms).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045100776144">
</a>
<a class="indexterm" name="idm46045100774656">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for usage">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--usage
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit; same as
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_help">
<code class="option">
--help
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_verbose">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_verbose">
<code class="option">
--verbose
</code>
</a>
</p>
<a class="indexterm" name="idm46045100763840">
</a>
<a class="indexterm" name="idm46045100762352">
</a>
<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>
<p>
Enable verbose messages.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_move_data_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-move-data.html#option_ndb_move_data_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045100752608">
</a>
<a class="indexterm" name="idm46045100751120">
</a>
<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>
<p>
Display version information and exit.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/password-too-long.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="password-too-long">
</a>
B.3.2.4 Password Fails When Entered Interactively
</h4>
</div>
</div>
</div>
<p>
MySQL client programs prompt for a password when invoked with
a
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
or
<code class="option">
-p
</code>
option that has no following password
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa12392448"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">user_name</em> <span class="token property">-p</span>
Enter password<span class="token punctuation">:</span></code></pre>
</div>
<p>
On some systems, you may find that your password works when
specified in an option file or on the command line, but not
when you enter it interactively at the
<code class="literal">
Enter
password:
</code>
prompt. This occurs when the library
provided by the system to read passwords limits password
values to a small number of characters (typically eight). That
is a problem with the system library, not with MySQL. To work
around it, change your MySQL password to a value that is eight
or fewer characters long, or put your password in an option
file.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-deploying-in-single-primary-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-deploying-in-single-primary-mode">
</a>
20.2.1 Deploying Group Replication in Single-Primary Mode
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-deploying-instances.html">
20.2.1.1 Deploying Instances for Group Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-configuring-instances.html">
20.2.1.2 Configuring an Instance for Group Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-user-credentials.html">
20.2.1.3 User Credentials For Distributed Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-launching.html">
20.2.1.4 Launching Group Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-bootstrap.html">
20.2.1.5 Bootstrapping the Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-adding-instances.html">
20.2.1.6 Adding Instances to the Group
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045134290784">
</a>
<p>
Each of the MySQL server instances in a group can run on an
independent physical host machine, which is the recommended way to
deploy Group Replication. This section explains how to create a
replication group with three MySQL Server instances, each running
on a different host machine. See
<a class="xref" href="group-replication-deploying-locally.html" title="20.2.2 Deploying Group Replication Locally">
Section 20.2.2, “Deploying Group Replication Locally”
</a>
for
information about deploying multiple MySQL server instances
running Group Replication on the same host machine, for example
for testing purposes.
</p>
<div class="figure">
<a name="idm46045134287536">
</a>
<p class="title">
<b>
Figure 20.7 Group Architecture
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Three server instances, S1, S2, and S3, are deployed as an interconnected group, and clients communicate with each of the server instances." src="images/gr-3-server-group.png" style="width: 100%; max-width: 238px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
This tutorial explains how to get and deploy MySQL Server with the
Group Replication plugin, how to configure each server instance
before creating a group, and how to use Performance Schema
monitoring to verify that everything is working correctly.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/table-corruption.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="table-corruption">
</a>
B.3.2.17 Table-Corruption Issues
</h4>
</div>
</div>
</div>
<p>
If you have started
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the
<a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
<code class="literal">
myisam_recover_options
</code>
</a>
system
variable set, MySQL automatically checks and tries to repair
<code class="literal">
MyISAM
</code>
tables if they are marked as 'not
closed properly' or 'crashed'. If this happens, MySQL writes
an entry in the
<code class="literal">
hostname.err
</code>
file
<code class="literal">
'Warning: Checking table ...'
</code>
which is
followed by
<code class="literal">
Warning: Repairing table
</code>
if the
table needs to be repaired. If you get a lot of these errors,
without
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
having died unexpectedly
just before, then something is wrong and needs to be
investigated further.
</p>
<p>
When the server detects
<code class="literal">
MyISAM
</code>
table
corruption, it writes additional information to the error log,
such as the name and line number of the source file, and the
list of threads accessing the table. Example:
<code class="literal">
Got an
error from thread_id=1, mi_dynrec.c:368
</code>
. This is
useful information to include in bug reports.
</p>
<p>
See also
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
, and
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-table-check-constraints.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="create-table-check-constraints">
</a>
15.1.20.6 CHECK Constraints
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045184917296">
</a>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
permits the core
features of table and column
<code class="literal">
CHECK
</code>
constraints, for all storage engines.
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
permits the
following
<code class="literal">
CHECK
</code>
constraint syntax, for both
table constraints and column constraints:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61731978"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CONSTRAINT</span> <span class="token punctuation">[</span><em class="replaceable">symbol</em><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token keyword">CHECK</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 operator">NOT</span><span class="token punctuation">]</span> <span class="token keyword">ENFORCED</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
The optional
<em class="replaceable">
<code>
symbol
</code>
</em>
specifies a name
for the constraint. If omitted, MySQL generates a name from the
table name, a literal
<code class="literal">
_chk_
</code>
, and an ordinal
number (1, 2, 3, ...). Constraint names have a maximum length of
64 characters. They are case-sensitive, but not
accent-sensitive.
</p>
<p>
<em class="replaceable">
<code>
expr
</code>
</em>
specifies the constraint
condition as a boolean expression that must evaluate to
<code class="literal">
TRUE
</code>
or
<code class="literal">
UNKNOWN
</code>
(for
<code class="literal">
NULL
</code>
values) for each row of the table. If
the condition evaluates to
<code class="literal">
FALSE
</code>
, it fails
and a constraint violation occurs. The effect of a violation
depends on the statement being executed, as described later in
this section.
</p>
<p>
The optional enforcement clause indicates whether the constraint
is enforced:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If omitted or specified as
<code class="literal">
ENFORCED
</code>
, the
constraint is created and enforced.
</p>
</li>
<li class="listitem">
<p>
If specified as
<code class="literal">
NOT ENFORCED
</code>
, the
constraint is created but not enforced.
</p>
</li>
</ul>
</div>
<p>
A
<code class="literal">
CHECK
</code>
constraint is specified as either a
table constraint or column constraint:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A table constraint does not appear within a column
definition and can refer to any table column or columns.
Forward references are permitted to columns appearing later
in the table definition.
</p>
</li>
<li class="listitem">
<p>
A column constraint appears within a column definition and
can refer only to that column.
</p>
</li>
</ul>
</div>
<p>
Consider this table definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76662174"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
<span class="token keyword">CHECK</span> <span class="token punctuation">(</span>c1 <span class="token operator"><></span> c2<span class="token punctuation">)</span><span class="token punctuation">,</span>
c1 <span class="token datatype">INT</span> <span class="token keyword">CHECK</span> <span class="token punctuation">(</span>c1 <span class="token operator">></span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c2 <span class="token datatype">INT</span> <span class="token keyword">CONSTRAINT</span> c2_positive <span class="token keyword">CHECK</span> <span class="token punctuation">(</span>c2 <span class="token operator">></span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c3 <span class="token datatype">INT</span> <span class="token keyword">CHECK</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 punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> c1_nonzero <span class="token keyword">CHECK</span> <span class="token punctuation">(</span>c1 <span class="token operator"><></span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">CHECK</span> <span class="token punctuation">(</span>c1 <span class="token operator">></span> c3<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The definition includes table constraints and column
constraints, in named and unnamed formats:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The first constraint is a table constraint: It occurs
outside any column definition, so it can (and does) refer to
multiple table columns. This constraint contains forward
references to columns not defined yet. No constraint name is
specified, so MySQL generates a name.
</p>
</li>
<li class="listitem">
<p>
The next three constraints are column constraints: Each
occurs within a column definition, and thus can refer only
to the column being defined. One of the constraints is named
explicitly. MySQL generates a name for each of the other
two.
</p>
</li>
<li class="listitem">
<p>
The last two constraints are table constraints. One of them
is named explicitly. MySQL generates a name for the other
one.
</p>
</li>
</ul>
</div>
<p>
As mentioned, MySQL generates a name for any
<code class="literal">
CHECK
</code>
constraint specified without one. To
see the names generated for the preceding table definition, use
<code class="literal">
SHOW CREATE TABLE
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74830841"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TABLE</span> t1\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>
Table<span class="token punctuation">:</span> t1
Create Table<span class="token punctuation">:</span> CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
CONSTRAINT `c1_nonzero` CHECK ((`c1` <> 0)),
CONSTRAINT `c2_positive` CHECK ((`c2` > 0)),
CONSTRAINT `t1_chk_1` CHECK ((`c1` <> `c2`)),
CONSTRAINT `t1_chk_2` CHECK ((`c1` > 10)),
CONSTRAINT `t1_chk_3` CHECK ((`c3` < 100)),
CONSTRAINT `t1_chk_4` CHECK ((`c1` > `c3`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<p>
The SQL standard specifies that all types of constraints
(primary key, unique index, foreign key, check) belong to the
same namespace. In MySQL, each constraint type has its own
namespace per schema (database). Consequently,
<code class="literal">
CHECK
</code>
constraint names must be unique per
schema; no two tables in the same schema can share a
<code class="literal">
CHECK
</code>
constraint name. (Exception: A
<code class="literal">
TEMPORARY
</code>
table hides a
non-
<code class="literal">
TEMPORARY
</code>
table of the same name, so it
can have the same
<code class="literal">
CHECK
</code>
constraint names as
well.)
</p>
<p>
Beginning generated constraint names with the table name helps
ensure schema uniqueness because table names also must be unique
within the schema.
</p>
<p>
<code class="literal">
CHECK
</code>
condition expressions must adhere to
the following rules. An error occurs if an expression contains
disallowed constructs.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Nongenerated and generated columns are permitted, except
columns with the
<code class="literal">
AUTO_INCREMENT
</code>
attribute
and columns in other tables.
</p>
</li>
<li class="listitem">
<p>
Literals, deterministic built-in functions, and operators
are permitted. A function is deterministic if, given the
same data in tables, multiple invocations produce the same
result, independently of the connected user. Examples of
functions that are nondeterministic and fail this
definition:
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
,
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
,
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Stored functions and loadable functions are not permitted.
</p>
</li>
<li class="listitem">
<p>
Stored procedure and function parameters are not permitted.
</p>
</li>
<li class="listitem">
<p>
Variables (system variables, user-defined variables, and
stored program local variables) are not permitted.
</p>
</li>
<li class="listitem">
<p>
Subqueries are not permitted.
</p>
</li>
</ul>
</div>
<p>
Foreign key referential actions (
<code class="literal">
ON UPDATE
</code>
,
<code class="literal">
ON DELETE
</code>
) are prohibited on columns used in
<code class="literal">
CHECK
</code>
constraints. Likewise,
<code class="literal">
CHECK
</code>
constraints are prohibited on columns
used in foreign key referential actions.
</p>
<p>
<code class="literal">
CHECK
</code>
constraints are evaluated for
<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>
,
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
,
<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="load-xml.html" title="15.2.10 LOAD XML Statement">
<code class="literal">
LOAD XML
</code>
</a>
statements and an error
occurs if a constraint evaluates to
<code class="literal">
FALSE
</code>
. If
an error occurs, handling of changes already applied differs for
transactional and nontransactional storage engines, and also
depends on whether strict SQL mode is in effect, as described in
<a class="xref" href="sql-mode.html#sql-mode-strict" title="Strict SQL Mode">
Strict SQL Mode
</a>
.
</p>
<p>
<code class="literal">
CHECK
</code>
constraints are evaluated for
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT IGNORE
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE IGNORE
</code>
</a>
,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA ...
IGNORE
</code>
</a>
, and
<a class="link" href="load-xml.html" title="15.2.10 LOAD XML Statement">
<code class="literal">
LOAD XML ...
IGNORE
</code>
</a>
statements and a warning occurs if a constraint
evaluates to
<code class="literal">
FALSE
</code>
. The insert or update for
any offending row is skipped.
</p>
<p>
If the constraint expression evaluates to a data type that
differs from the declared column type, implicit coercion to the
declared type occurs according to the usual MySQL
type-conversion rules. See
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
. If
type conversion fails or results in a loss of precision, an
error occurs.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Constraint expression evaluation uses the SQL mode in effect
at evaluation time. If any component of the expression depends
on the SQL mode, different results may occur for different
uses of the table unless the SQL mode is the same during all
uses.
</p>
</div>
<p>
The Information Schema
<a class="link" href="information-schema-check-constraints-table.html" title="28.3.5 The INFORMATION_SCHEMA CHECK_CONSTRAINTS Table">
<code class="literal">
CHECK_CONSTRAINTS
</code>
</a>
table provides
information about
<code class="literal">
CHECK
</code>
constraints defined
on tables. See
<a class="xref" href="information-schema-check-constraints-table.html" title="28.3.5 The INFORMATION_SCHEMA CHECK_CONSTRAINTS Table">
Section 28.3.5, “The INFORMATION_SCHEMA CHECK_CONSTRAINTS Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-javascript-table-delete.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-shell-tutorial-javascript-table-delete">
</a>
22.3.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-javascript-delete-records-using-conditions">
</a>
Delete Records Using Conditions
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127475776">
</a>
<p>
The following example passes search conditions to the
<code class="literal">
delete()
</code>
method. All records matching the
condition are deleted from the city 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="sa3047573"><div class="copy-help left">Press ⌘+C to 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-js></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-javascript-delete-first-record">
</a>
Delete the First Record
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127469888">
</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="sa68840959"><div class="copy-help left">Press ⌘+C to 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-js></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-javascript-delete-all-records">
</a>
Delete All Records in a Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127464208">
</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="idm46045127460464">
</a>
Drop a Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127459792">
</a>
<p>
The
<code class="literal">
dropCollection()
</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="sa24218519"><div class="copy-help left">Press ⌘+C to 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-js></span> session<span class="token punctuation">.</span><span class="token function">dropCollection</span><span class="token punctuation">(</span><span class="token string">"world_x"</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="idm46045127453824">
</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-javascript-download.html" title="22.3.2 Download and Import world_x Database">
Section 22.3.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/innodb-preload-buffer-pool.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-preload-buffer-pool">
</a>
17.8.3.6 Saving and Restoring the Buffer Pool State
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162979136">
</a>
<a class="indexterm" name="idm46045162978064">
</a>
<p>
To reduce the
<a class="link" href="glossary.html#glos_warm_up" title="warm up">
warmup
</a>
period
after restarting the server,
<code class="literal">
InnoDB
</code>
saves a
percentage of the most recently used pages for each buffer pool
at server shutdown and restores these pages at server startup.
The percentage of recently used pages that is stored is defined
by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_pct">
<code class="literal">
innodb_buffer_pool_dump_pct
</code>
</a>
configuration option.
</p>
<p>
After restarting a busy server, there is typically a warmup
period with steadily increasing throughput, as disk pages that
were in the buffer pool are brought back into memory (as the
same data is queried, updated, and so on). The ability to
restore the buffer pool at startup shortens the warmup period by
reloading disk pages that were in the buffer pool before the
restart rather than waiting for DML operations to access
corresponding rows. Also, I/O requests can be performed in large
batches, making the overall I/O faster. Page loading happens in
the background, and does not delay database startup.
</p>
<p>
In addition to saving the buffer pool state at shutdown and
restoring it at startup, you can save and restore the buffer
pool state at any time, while the server is running. For
example, you can save the state of the buffer pool after
reaching a stable throughput under a steady workload. You could
also restore the previous buffer pool state after running
reports or maintenance jobs that bring data pages into the
buffer pool that are only requited for those operations, or
after running some other non-typical workload.
</p>
<p>
Even though a buffer pool can be many gigabytes in size, the
buffer pool data that
<code class="literal">
InnoDB
</code>
saves to disk is
tiny by comparison. Only tablespace IDs and page IDs necessary
to locate the appropriate pages are saved to disk. This
information is derived from the
<a class="link" href="information-schema-innodb-buffer-page-lru-table.html" title="28.4.3 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table">
<code class="literal">
INNODB_BUFFER_PAGE_LRU
</code>
</a>
<code class="literal">
INFORMATION_SCHEMA
</code>
table. By default,
tablespace ID and page ID data is saved in a file named
<code class="filename">
ib_buffer_pool
</code>
, which is saved to the
<code class="literal">
InnoDB
</code>
data directory. The file name and
location can be modified using the
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_filename">
<code class="literal">
innodb_buffer_pool_filename
</code>
</a>
configuration parameter.
</p>
<p>
Because data is cached in and aged out of the buffer pool as it
is with regular database operations, there is no problem if the
disk pages are recently updated, or if a DML operation involves
data that has not yet been loaded. The loading mechanism skips
requested pages that no longer exist.
</p>
<p>
The underlying mechanism involves a background thread that is
dispatched to perform the dump and load operations.
</p>
<p>
Disk pages from compressed tables are loaded into the buffer
pool in their compressed form. Pages are uncompressed as usual
when page contents are accessed during DML operations. Because
uncompressing pages is a CPU-intensive process, it is more
efficient for concurrency to perform the operation in a
connection thread rather than in the single thread that performs
the buffer pool restore operation.
</p>
<p>
Operations related to saving and restoring the buffer pool state
are described in the following topics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-dump-pct" title="Configuring the Dump Percentage for Buffer Pool Pages">
Configuring the Dump Percentage for Buffer Pool Pages
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-offline" title="Saving the Buffer Pool State at Shutdown and Restoring it at Startup">
Saving the Buffer Pool State at Shutdown and Restoring it at Startup
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-online" title="Saving and Restoring the Buffer Pool State Online">
Saving and Restoring the Buffer Pool State Online
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-dump-progress" title="Displaying Buffer Pool Dump Progress">
Displaying Buffer Pool Dump Progress
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-load-progress" title="Displaying Buffer Pool Load Progress">
Displaying Buffer Pool Load Progress
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#innodb-preload-buffer-pool-abort-load" title="Aborting a Buffer Pool Load Operation">
Aborting a Buffer Pool Load Operation
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-preload-buffer-pool.html#monitor-buffer-pool-load-performance-schema" title="Monitoring Buffer Pool Load Progress Using Performance Schema">
Monitoring Buffer Pool Load Progress Using Performance Schema
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-preload-buffer-pool-dump-pct">
</a>
Configuring the Dump Percentage for Buffer Pool Pages
</h5>
</div>
</div>
</div>
<p>
Before dumping pages from the buffer pool, you can configure
the percentage of most-recently-used buffer pool pages that
you want to dump by setting the
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_pct">
<code class="literal">
innodb_buffer_pool_dump_pct
</code>
</a>
option. If you plan to dump buffer pool pages while the server
is running, you can configure the option dynamically:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67757593"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_buffer_pool_dump_pct<span class="token operator">=</span><span class="token number">40</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you plan to dump buffer pool pages at server shutdown, set
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_pct">
<code class="literal">
innodb_buffer_pool_dump_pct
</code>
</a>
in your configuration file.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa88861208"><div class="copy-help left">Press ⌘+C to 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">innodb_buffer_pool_dump_pct</span><span class="token attr-value"><span class="token punctuation">=</span>40</span></code></pre>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_pct">
<code class="literal">
innodb_buffer_pool_dump_pct
</code>
</a>
default value is 25 (dump 25% of most-recently-used pages).
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-preload-buffer-pool-offline">
</a>
Saving the Buffer Pool State at Shutdown and Restoring it at Startup
</h5>
</div>
</div>
</div>
<p>
To save the state of the buffer pool at server shutdown, issue
the following statement prior to shutting down the server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa46760145"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_buffer_pool_dump_at_shutdown<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_at_shutdown">
<code class="literal">
innodb_buffer_pool_dump_at_shutdown
</code>
</a>
is enabled by default.
</p>
<p>
To restore the buffer pool state at server startup, specify
the
<code class="literal">
--innodb-buffer-pool-load-at-startup
</code>
option when starting the server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa92818934"><div class="copy-help left">Press ⌘+C to 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">mysqld <span class="token constant">--innodb-buffer-pool-load-at-startup</span><span class="token attr-value"><span class="token punctuation">=</span>ON;</span></code></pre>
</div>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_load_at_startup">
<code class="literal">
innodb_buffer_pool_load_at_startup
</code>
</a>
is enabled by default.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-preload-buffer-pool-online">
</a>
Saving and Restoring the Buffer Pool State Online
</h5>
</div>
</div>
</div>
<p>
To save the state of the buffer pool while MySQL server is
running, issue the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa58846415"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_buffer_pool_dump_now<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To restore the buffer pool state while MySQL is running, issue
the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa2401883"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_buffer_pool_load_now<span class="token operator">=</span><span class="token keyword">ON</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="innodb-preload-buffer-pool-dump-progress">
</a>
Displaying Buffer Pool Dump Progress
</h5>
</div>
</div>
</div>
<p>
To display progress when saving the buffer pool state to disk,
issue the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa16007611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Innodb_buffer_pool_dump_status'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the operation has not yet started,
<span class="quote">
“
<span class="quote">
not
started
</span>
”
</span>
is returned. If the operation is complete, the
completion time is printed (e.g. Finished at 110505 12:18:02).
If the operation is in progress, status information is
provided (e.g. Dumping buffer pool 5/7, page 237/2873).
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-preload-buffer-pool-load-progress">
</a>
Displaying Buffer Pool Load Progress
</h5>
</div>
</div>
</div>
<p>
To display progress when loading the buffer pool, issue the
following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa27455180"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Innodb_buffer_pool_load_status'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the operation has not yet started,
<span class="quote">
“
<span class="quote">
not
started
</span>
”
</span>
is returned. If the operation is complete, the
completion time is printed (e.g. Finished at 110505 12:23:24).
If the operation is in progress, status information is
provided (e.g. Loaded 123/22301 pages).
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-preload-buffer-pool-abort-load">
</a>
Aborting a Buffer Pool Load Operation
</h5>
</div>
</div>
</div>
<p>
To abort a buffer pool load operation, issue the following
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa69111799"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_buffer_pool_load_abort<span class="token operator">=</span><span class="token keyword">ON</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="monitor-buffer-pool-load-performance-schema">
</a>
Monitoring Buffer Pool Load Progress Using Performance Schema
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162921280">
</a>
<a class="indexterm" name="idm46045162919792">
</a>
<p>
You can monitor buffer pool load progress using
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance Schema
</a>
.
</p>
<p>
The following example demonstrates how to enable the
<code class="literal">
stage/innodb/buffer pool load
</code>
stage event
instrument and related consumer tables to monitor buffer pool
load progress.
</p>
<p>
For information about buffer pool dump and load procedures
used in this example, see
<a class="xref" href="innodb-preload-buffer-pool.html" title="17.8.3.6 Saving and Restoring the Buffer Pool State">
Section 17.8.3.6, “Saving and Restoring the Buffer Pool State”
</a>
. For information
about Performance Schema stage event instruments and related
consumers, see
<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>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Enable the
<code class="literal">
stage/innodb/buffer pool
load
</code>
instrument:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50867671"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> 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">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'stage/innodb/buffer%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Enable the stage event consumer tables, which include
<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>
,
<a class="link" href="performance-schema-events-stages-history-table.html" title="29.12.5.2 The events_stages_history Table">
<code class="literal">
events_stages_history
</code>
</a>
, and
<a class="link" href="performance-schema-events-stages-history-long-table.html" title="29.12.5.3 The events_stages_history_long Table">
<code class="literal">
events_stages_history_long
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24683965"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> performance_schema<span class="token punctuation">.</span>setup_consumers <span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%stages%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Dump the current buffer pool state by enabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_dump_now">
<code class="literal">
innodb_buffer_pool_dump_now
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97446219"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> innodb_buffer_pool_dump_now<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Check the buffer pool dump status to ensure that the
operation has completed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7788025"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Innodb_buffer_pool_dump_status'</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>
Variable_name<span class="token punctuation">:</span> Innodb_buffer_pool_dump_status
Value<span class="token punctuation">:</span> Buffer pool(s) dump completed at 150202 16<span class="token punctuation">:</span>38<span class="token punctuation">:</span>58</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Load the buffer pool by enabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_load_now">
<code class="literal">
innodb_buffer_pool_load_now
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59666568"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> innodb_buffer_pool_load_now<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Check the current status of the buffer pool load operation
by querying the Performance Schema
<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>
table.
The
<code class="literal">
WORK_COMPLETED
</code>
column shows the
number of buffer pool pages loaded. The
<code class="literal">
WORK_ESTIMATED
</code>
column provides an
estimate of the remaining work, in pages.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86219923"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> 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 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>
<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>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/buffer pool load <span class="token punctuation">|</span> 5353 <span class="token punctuation">|</span> 7167 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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
<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>
table returns an empty set if the buffer pool load
operation has completed. In this case, you can check the
<a class="link" href="performance-schema-events-stages-history-table.html" title="29.12.5.2 The events_stages_history Table">
<code class="literal">
events_stages_history
</code>
</a>
table
to view data for the completed event. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58437167"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> 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_history<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>
<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>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/buffer pool load <span class="token punctuation">|</span> 7167 <span class="token punctuation">|</span> 7167 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You can also monitor buffer pool load progress using
Performance Schema when loading the buffer pool at startup
using
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_load_at_startup">
<code class="literal">
innodb_buffer_pool_load_at_startup
</code>
</a>
.
In this case, the
<code class="literal">
stage/innodb/buffer pool
load
</code>
instrument and related consumers must be
enabled at startup. For more information, see
<a class="xref" href="performance-schema-startup-configuration.html" title="29.3 Performance Schema Startup Configuration">
Section 29.3, “Performance Schema Startup Configuration”
</a>
.
</p>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndb-api-statistics.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-ndb-api-statistics">
</a>
25.6.16 NDB API Statistics Counters and Variables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045091110544">
</a>
<a class="indexterm" name="idm46045091109056">
</a>
<a class="indexterm" name="idm46045091108016">
</a>
<p>
A number of types of statistical counters relating to actions
performed by or affecting
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
objects are available. Such actions include starting and closing
(or aborting) transactions; primary key and unique key operations;
table, range, and pruned scans; threads blocked while waiting for
the completion of various operations; and data and events sent and
received by
<code class="literal">
NDBCLUSTER
</code>
. The counters are
incremented inside the NDB kernel whenever NDB API calls are made
or data is sent to or received by the data nodes.
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
exposes these counters as system status
variables; their values can be read in the output of
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW STATUS
</code>
</a>
, or by querying the
Performance Schema
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
session_status
</code>
</a>
or
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
global_status
</code>
</a>
table. By comparing the
values before and after statements operating on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, you can observe the
corresponding actions taken on the API level, and thus the cost of
performing the statement.
</p>
<p>
You can list all of these status variables using the following
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW STATUS
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10467556"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%'</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> 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count <span class="token punctuation">|</span> 74 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count <span class="token punctuation">|</span> 31453031678 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count <span class="token punctuation">|</span> 3336 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count <span class="token punctuation">|</span> 103568 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 2022486 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 268 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 10332 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_session <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>
<span class="token output">90 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
These status variables are also available from the Performance
Schema
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
session_status
</code>
</a>
and
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
global_status
</code>
</a>
tables, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86049965"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>session_status
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> VARIABLE_NAME <span class="token operator">LIKE</span> <span class="token string">'ndb_api%'</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>
<span class="token output"><span class="token punctuation">|</span> VARIABLE_NAME <span class="token punctuation">|</span> VARIABLE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count <span class="token punctuation">|</span> 81 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count <span class="token punctuation">|</span> 119485762051 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count <span class="token punctuation">|</span> 3476 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count <span class="token punctuation">|</span> 105372 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 2022486 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 268 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 10332 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_session <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>
<span class="token output">90 rows in set (0.00 sec)</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>global_status
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> VARIABLE_NAME <span class="token operator">LIKE</span> <span class="token string">'ndb_api%'</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>
<span class="token output"><span class="token punctuation">|</span> VARIABLE_NAME <span class="token punctuation">|</span> VARIABLE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count <span class="token punctuation">|</span> 88 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count <span class="token punctuation">|</span> 159810484729 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count <span class="token punctuation">|</span> 3616 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count <span class="token punctuation">|</span> 107176 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_replica <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 2022486 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 268 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 10332 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_session <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>
<span class="token output">90 rows in set (0.01 sec)</span></code></pre>
</div>
<a class="indexterm" name="idm46045091052368">
</a>
<a class="indexterm" name="idm46045091050864">
</a>
<p>
Each
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
object has its own
counters. NDB API applications can read the values of the counters
for use in optimization or monitoring. For multithreaded clients
which use more than one
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
object concurrently, it is also possible to obtain a summed view
of counters from all
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
objects
belonging to a given
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb-cluster-connection.html" target="_top">
<code class="literal">
Ndb_cluster_connection
</code>
</a>
.
</p>
<p>
Four sets of these counters are exposed. One set applies to the
current session only; the other 3 are global.
<span class="emphasis">
<em>
This is in
spite of the fact that their values can be obtained as either
session or global status variables in 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
</em>
</span>
. This means that specifying the
<code class="literal">
SESSION
</code>
or
<code class="literal">
GLOBAL
</code>
keyword
with
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW STATUS
</code>
</a>
has no effect on
the values reported for NDB API statistics status variables, and
the value for each of these variables is the same whether the
value is obtained from the equivalent column of the
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
session_status
</code>
</a>
or the
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
global_status
</code>
</a>
table.
</p>
<a class="indexterm" name="idm46045091036256">
</a>
<a class="indexterm" name="idm46045091034752">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Session counters (session specific)
</em>
</span>
</p>
<p>
Session counters relate to the
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
objects in use by (only)
the current session. Use of such objects by other MySQL
clients does not influence these counts.
</p>
<p>
In order to minimize confusion with standard MySQL session
variables, we refer to the variables that correspond to these
NDB API session counters as
<span class="quote">
“
<span class="quote">
<code class="literal">
_session
</code>
variables
</span>
”
</span>
, with a leading underscore.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Replica counters (global)
</em>
</span>
</p>
<p>
This set of counters relates to the
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
objects used by the
replica SQL thread, if any. If this
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
does not act as a replica, or does not use
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, then all of these
counts are 0.
</p>
<p>
We refer to the related status variables as
<span class="quote">
“
<span class="quote">
<code class="literal">
_replica
</code>
variables
</span>
”
</span>
(with a
leading underscore).
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Injector counters (global)
</em>
</span>
</p>
<p>
Injector counters relate to the
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
object used to listen to
cluster events by the binary log injector thread. Even when
not writing a binary log,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
processes
attached to an NDB Cluster continue to listen for some events,
such as schema changes.
</p>
<p>
We refer to the status variables that correspond to NDB API
injector counters as
<span class="quote">
“
<span class="quote">
<code class="literal">
_injector
</code>
variables
</span>
”
</span>
(with a leading underscore).
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Server (Global) counters (global)
</em>
</span>
</p>
<p>
This set of counters relates to all
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
<code class="literal">
Ndb
</code>
</a>
objects currently used by
this
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. This includes all MySQL client
applications, the replica SQL thread (if any), the binary log
injector, and the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
utility
thread.
</p>
<p>
We refer to the status variables that correspond to these
counters as
<span class="quote">
“
<span class="quote">
global variables
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
-level variables
</span>
”
</span>
.
</p>
</li>
</ul>
</div>
<p>
You can obtain values for a particular set of variables by
additionally filtering for the substring
<code class="literal">
session
</code>
,
<code class="literal">
replica
</code>
, or
<code class="literal">
injector
</code>
in the variable name (along with the
common prefix
<code class="literal">
Ndb_api
</code>
). For
<code class="literal">
_session
</code>
variables, this can be done as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25869197"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%session'</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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 2022486 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 268 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 10332 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_forced_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_unforced_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_adaptive_send_deferred_count_session <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>
<span class="token output">21 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
To obtain a listing of the NDB API
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
-level
status variables, filter for variable names beginning with
<code class="literal">
ndb_api
</code>
and ending in
<code class="literal">
_count
</code>
, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21225759"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>session_status
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> VARIABLE_NAME <span class="token operator">LIKE</span> <span class="token string">'ndb_api%count'</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> VARIABLE_NAME <span class="token punctuation">|</span> VARIABLE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_WAIT_EXEC_COMPLETE_COUNT <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_WAIT_SCAN_RESULT_COUNT <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_WAIT_META_REQUEST_COUNT <span class="token punctuation">|</span> 28 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_WAIT_NANOS_COUNT <span class="token punctuation">|</span> 53756398 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_BYTES_SENT_COUNT <span class="token punctuation">|</span> 1060 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_BYTES_RECEIVED_COUNT <span class="token punctuation">|</span> 9724 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TRANS_START_COUNT <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TRANS_COMMIT_COUNT <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TRANS_ABORT_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TRANS_CLOSE_COUNT <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_PK_OP_COUNT <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_UK_OP_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TABLE_SCAN_COUNT <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_RANGE_SCAN_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_PRUNED_SCAN_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_SCAN_BATCH_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_READ_ROW_COUNT <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_TRANS_LOCAL_READ_ROW_COUNT <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_EVENT_DATA_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_EVENT_NONDATA_COUNT <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NDB_API_EVENT_BYTES_COUNT <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>
<span class="token output">21 rows in set (0.09 sec)</span></code></pre>
</div>
<p>
Not all counters are reflected in all 4 sets of status variables.
For the event counters
<code class="literal">
DataEventsRecvdCount
</code>
,
<code class="literal">
NondataEventsRecvdCount
</code>
, and
<code class="literal">
EventBytesRecvdCount
</code>
, only
<code class="literal">
_injector
</code>
and
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
-level
NDB API status variables are available:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66341745"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%event%'</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>
<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 class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count <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>
<span class="token output">6 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
<code class="literal">
_injector
</code>
status variables are not implemented
for any other NDB API counters, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96492355"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%injector%'</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>
<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 class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_data_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_nondata_count_injector <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_event_bytes_count_injector <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>
<span class="token output">3 rows in set (0.00 sec)</span></code></pre>
</div>
<a class="indexterm" name="idm46045090981504">
</a>
<a class="indexterm" name="idm46045090979984">
</a>
<p>
The names of the status variables can easily be associated with
the names of the corresponding counters. Each NDB API statistics
counter is listed in the following table with a description as
well as the names of any MySQL server status variables
corresponding to this counter.
</p>
<div class="table">
<a name="idm46045090977760">
</a>
<p class="title">
<b>
Table 25.39 NDB API statistics counters
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 30%"/>
<col style="width: 35%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Counter Name
</th>
<th scope="col">
Description
</th>
<th scope="col">
Status Variables (by statistic type):
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Session
</p>
</li>
<li class="listitem">
<p>
Replica (slave)
</p>
</li>
<li class="listitem">
<p>
Injector
</p>
</li>
<li class="listitem">
<p>
Server
</p>
</li>
</ul>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
WaitExecCompleteCount
</code>
</th>
<td>
Number of times thread has been blocked while waiting for execution of
an operation to complete. Includes all
<a class="ulink" href="/doc/ndbapi/en/ndb-ndbtransaction.html#ndb-ndbtransaction-execute" target="_top">
<code class="literal">
execute()
</code>
</a>
calls as well as implicit executes for blob operations and
auto-increment not visible to clients.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_exec_complete_count_session">
<code class="literal">
Ndb_api_wait_exec_complete_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_exec_complete_count_replica">
<code class="literal">
Ndb_api_wait_exec_complete_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_exec_complete_count">
<code class="literal">
Ndb_api_wait_exec_complete_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
WaitScanResultCount
</code>
</th>
<td>
Number of times thread has been blocked while waiting for a scan-based
signal, such waiting for additional results, or for a scan
to close.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_scan_result_count_session">
<code class="literal">
Ndb_api_wait_scan_result_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_scan_result_count_replica">
<code class="literal">
Ndb_api_wait_scan_result_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_scan_result_count">
<code class="literal">
Ndb_api_wait_scan_result_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
WaitMetaRequestCount
</code>
</th>
<td>
Number of times thread has been blocked waiting for a metadata-based
signal; this can occur when waiting for a DDL operation or
for an epoch to be started (or ended).
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_meta_request_count_session">
<code class="literal">
Ndb_api_wait_meta_request_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_meta_request_count_replica">
<code class="literal">
Ndb_api_wait_meta_request_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_meta_request_count">
<code class="literal">
Ndb_api_wait_meta_request_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
WaitNanosCount
</code>
</th>
<td>
Total time (in nanoseconds) spent waiting for some type of signal from
the data nodes.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count_session">
<code class="literal">
Ndb_api_wait_nanos_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count_replica">
<code class="literal">
Ndb_api_wait_nanos_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count">
<code class="literal">
Ndb_api_wait_nanos_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
BytesSentCount
</code>
</th>
<td>
Amount of data (in bytes) sent to the data nodes
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_sent_count_session">
<code class="literal">
Ndb_api_bytes_sent_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_sent_count_replica">
<code class="literal">
Ndb_api_bytes_sent_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_sent_count">
<code class="literal">
Ndb_api_bytes_sent_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
BytesRecvdCount
</code>
</th>
<td>
Amount of data (in bytes) received from the data nodes
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_received_count_session">
<code class="literal">
Ndb_api_bytes_received_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_received_count_slave">
<code class="literal">
Ndb_api_bytes_received_count_slave
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_bytes_received_count">
<code class="literal">
Ndb_api_bytes_received_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TransStartCount
</code>
</th>
<td>
Number of transactions started.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_start_count_session">
<code class="literal">
Ndb_api_trans_start_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_start_count_replica">
<code class="literal">
Ndb_api_trans_start_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_start_count">
<code class="literal">
Ndb_api_trans_start_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TransCommitCount
</code>
</th>
<td>
Number of transactions committed.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_commit_count_session">
<code class="literal">
Ndb_api_trans_commit_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_commit_count_replica">
<code class="literal">
Ndb_api_trans_commit_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_commit_count">
<code class="literal">
Ndb_api_trans_commit_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TransAbortCount
</code>
</th>
<td>
Number of transactions aborted.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_abort_count_session">
<code class="literal">
Ndb_api_trans_abort_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_abort_count_replica">
<code class="literal">
Ndb_api_trans_abort_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_abort_count">
<code class="literal">
Ndb_api_trans_abort_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TransCloseCount
</code>
</th>
<td>
Number of transactions aborted. (This value may be greater than the sum
of
<code class="literal">
TransCommitCount
</code>
and
<code class="literal">
TransAbortCount
</code>
.)
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_close_count_session">
<code class="literal">
Ndb_api_trans_close_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_close_count_replica">
<code class="literal">
Ndb_api_trans_close_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_close_count">
<code class="literal">
Ndb_api_trans_close_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
PkOpCount
</code>
</th>
<td>
Number of operations based on or using primary keys. This count includes
blob-part table operations, implicit unlocking operations,
and auto-increment operations, as well as primary key
operations normally visible to MySQL clients.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pk_op_count_session">
<code class="literal">
Ndb_api_pk_op_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pk_op_count_replica">
<code class="literal">
Ndb_api_pk_op_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pk_op_count">
<code class="literal">
Ndb_api_pk_op_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
UkOpCount
</code>
</th>
<td>
Number of operations based on or using unique keys.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_uk_op_count_session">
<code class="literal">
Ndb_api_uk_op_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_uk_op_count_replica">
<code class="literal">
Ndb_api_uk_op_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_uk_op_count">
<code class="literal">
Ndb_api_uk_op_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TableScanCount
</code>
</th>
<td>
Number of table scans that have been started. This includes scans of
internal tables.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_table_scan_count_session">
<code class="literal">
Ndb_api_table_scan_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_table_scan_count_replica">
<code class="literal">
Ndb_api_table_scan_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_table_scan_count">
<code class="literal">
Ndb_api_table_scan_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
RangeScanCount
</code>
</th>
<td>
Number of range scans that have been started.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_range_scan_count_session">
<code class="literal">
Ndb_api_range_scan_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_range_scan_count_replica">
<code class="literal">
Ndb_api_range_scan_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_range_scan_count">
<code class="literal">
Ndb_api_range_scan_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
PrunedScanCount
</code>
</th>
<td>
Number of scans that have been pruned to a single partition.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pruned_scan_count_session">
<code class="literal">
Ndb_api_pruned_scan_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pruned_scan_count_replica">
<code class="literal">
Ndb_api_pruned_scan_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pruned_scan_count">
<code class="literal">
Ndb_api_pruned_scan_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
ScanBatchCount
</code>
</th>
<td>
Number of batches of rows received. (A
<span class="firstterm">
batch
</span>
in this context
is a set of scan results from a single fragment.)
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_scan_batch_count_session">
<code class="literal">
Ndb_api_scan_batch_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_scan_batch_count_replica">
<code class="literal">
Ndb_api_scan_batch_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_scan_batch_count">
<code class="literal">
Ndb_api_scan_batch_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
ReadRowCount
</code>
</th>
<td>
Total number of rows that have been read. Includes rows read using
primary key, unique key, and scan operations.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_read_row_count_session">
<code class="literal">
Ndb_api_read_row_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_read_row_count_replica">
<code class="literal">
Ndb_api_read_row_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_read_row_count">
<code class="literal">
Ndb_api_read_row_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
TransLocalReadRowCount
</code>
</th>
<td>
Number of rows read from the data same node on which the transaction was
being run.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_local_read_row_count_session">
<code class="literal">
Ndb_api_trans_local_read_row_count_session
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_local_read_row_count_replica">
<code class="literal">
Ndb_api_trans_local_read_row_count_replica
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_local_read_row_count">
<code class="literal">
Ndb_api_trans_local_read_row_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DataEventsRecvdCount
</code>
</th>
<td>
Number of row change events received.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_data_count_injector">
<code class="literal">
Ndb_api_event_data_count_injector
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_data_count">
<code class="literal">
Ndb_api_event_data_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
NondataEventsRecvdCount
</code>
</th>
<td>
Number of events received, other than row change events.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_nondata_count_injector">
<code class="literal">
Ndb_api_event_nondata_count_injector
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_nondata_count">
<code class="literal">
Ndb_api_event_nondata_count
</code>
</a>
</p>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
EventBytesRecvdCount
</code>
</th>
<td>
Number of bytes of events received.
</td>
<td>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
[none]
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_bytes_count_injector">
<code class="literal">
Ndb_api_event_bytes_count_injector
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_event_bytes_count">
<code class="literal">
Ndb_api_event_bytes_count
</code>
</a>
</p>
</li>
</ul>
</div>
</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: 199.219px;">
Counter Name
</th>
<th scope="col" style="width: 160.5px;">
Description
</th>
<th scope="col" style="width: 378.281px;">
Status Variables (by statistic type):
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Session
</p>
</li>
<li class="listitem">
<p>
Replica (slave)
</p>
</li>
<li class="listitem">
<p>
Injector
</p>
</li>
<li class="listitem">
<p>
Server
</p>
</li>
</ul>
</div>
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
To see all counts of committed transactions—that is, all
<code class="literal">
TransCommitCount
</code>
counter status
variables—you can filter the results of
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW STATUS
</code>
</a>
for the substring
<code class="literal">
trans_commit_count
</code>
, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8288054"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'%trans_commit_count%'</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> 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_slave <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count <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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">3 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
From this you can determine that 1 transaction has been committed
in the current
<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 session, and 2
transactions have been committed on this
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
since it was last restarted.
</p>
<p>
You can see how various NDB API counters are incremented by a
given SQL statement by comparing the values of the corresponding
<code class="literal">
_session
</code>
status variables immediately before
and after performing the statement. In this example, after getting
the initial values from
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
, we create in the
<code class="literal">
test
</code>
database an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table, named
<code class="literal">
t
</code>
, that has a single column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14463494"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%session%'</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> 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 820705 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 132 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 372 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <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>
<span class="token output">18 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token keyword">Database</span> <span class="token keyword">changed</span>
<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">INT</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.85 sec)</span></code></pre>
</div>
<p>
Now you can execute a new
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
statement and observe the changes, as shown here
(with the changed rows highlighted in the output):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22625805"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%session%'</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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span><em>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span></em><span class="token output"><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 17 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 706871709 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 2376 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 3844 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <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>
<span class="token output">18 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
Similarly, you can see the changes in the NDB API statistics
counters caused by inserting a row into
<code class="literal">
t
</code>
:
Insert the row, then run the same
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
statement used in the previous example, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6502045"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ndb_api%session%'</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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_exec_complete_count_session <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_scan_result_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_meta_request_count_session <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_wait_nanos_count_session <span class="token punctuation">|</span> 707370418 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_bytes_sent_count_session <span class="token punctuation">|</span> 2724 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_bytes_received_count_session <span class="token punctuation">|</span> 4116 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_start_count_session <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_commit_count_session <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_trans_abort_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_close_count_session <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_pk_op_count_session <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_uk_op_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_table_scan_count_session <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_range_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_pruned_scan_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ndb_api_scan_batch_count_session <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_read_row_count_session <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation"></span><em><span class="token punctuation">|</span> Ndb_api_trans_local_read_row_count_session <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></em><span class="token punctuation"></span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">18 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
We can make a number of observations from these results:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Although we created
<code class="literal">
t
</code>
with no explicit
primary key, 5 primary key operations were performed in doing
so (the difference in the
<span class="quote">
“
<span class="quote">
before
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
after
</span>
”
</span>
values of
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_pk_op_count_session">
<code class="literal">
Ndb_api_pk_op_count_session
</code>
</a>
,
or 6 minus 1). This reflects the creation of the hidden
primary key that is a feature of all tables using 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>
By comparing successive values for
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count_session">
<code class="literal">
Ndb_api_wait_nanos_count_session
</code>
</a>
,
we can see that the NDB API operations implementing the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement waited
much longer (706871709 - 820705 = 706051004 nanoseconds, or
approximately 0.7 second) for responses from the data nodes
than those executed by the
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
(707370418 - 706871709 =
498709 ns or roughly .0005 second). The execution times
reported for these statements in 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 correlate roughly with these figures.
</p>
<p>
On platforms without sufficient (nanosecond) time resolution,
small changes in the value of the
<code class="literal">
WaitNanosCount
</code>
NDB API counter due to SQL
statements that execute very quickly may not always be visible
in the values of
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count_session">
<code class="literal">
Ndb_api_wait_nanos_count_session
</code>
</a>
,
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count_replica">
<code class="literal">
Ndb_api_wait_nanos_count_replica
</code>
</a>
,
or
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_wait_nanos_count">
<code class="literal">
Ndb_api_wait_nanos_count
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement
incremented both the
<code class="literal">
ReadRowCount
</code>
and
<code class="literal">
TransLocalReadRowCount
</code>
NDB API statistics
counters, as reflected by the increased values of
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_read_row_count_session">
<code class="literal">
Ndb_api_read_row_count_session
</code>
</a>
and
<a class="link" href="mysql-cluster-options-variables.html#statvar_Ndb_api_trans_local_read_row_count_session">
<code class="literal">
Ndb_api_trans_local_read_row_count_session
</code>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-log-status-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-log-status-table">
</a>
29.12.22.5 The log_status Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045067454416">
</a>
<a class="indexterm" name="idm46045067452928">
</a>
<p>
The
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table provides
information that enables an online backup tool to copy the
required log files without locking those resources for the
duration of the copy process.
</p>
<p>
When the
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table is
queried, the server blocks logging and related administrative
changes for just long enough to populate the table, then
releases the resources. The
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table informs the
online backup which point it should copy up to in the source's
binary log and
<code class="literal">
gtid_executed
</code>
record, and
the relay log for each replication channel. It also provides
relevant information for individual storage engines, such as
the last log sequence number (LSN) and the LSN of the last
checkpoint taken for the
<code class="literal">
InnoDB
</code>
storage
engine.
</p>
<p>
The
<code class="literal">
log_status
</code>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SERVER_UUID
</code>
</p>
<p>
The server UUID for this server instance. This is the
generated unique value of the read-only system variable
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LOCAL
</code>
</p>
<p>
The log position state information from the source,
provided as a single JSON object with the following keys:
</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">
binary_log_file
</code>
</span>
</dt>
<dd>
<p>
The name of the current binary log file.
</p>
</dd>
<dt>
<span class="term">
<code class="literal">
binary_log_position
</code>
</span>
</dt>
<dd>
<p>
The current binary log position at the time the
<code class="literal">
log_status
</code>
table was accessed.
</p>
</dd>
<dt>
<span class="term">
<code class="literal">
gtid_executed
</code>
</span>
</dt>
<dd>
<p>
The current value of the global server variable
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
at
the time the
<code class="literal">
log_status
</code>
table
was accessed. This information is consistent with
the
<code class="literal">
binary_log_file
</code>
and
<code class="literal">
binary_log_position
</code>
keys.
</p>
</dd>
</dl>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REPLICATION
</code>
</p>
<p>
A JSON array of channels, each with the following
information:
</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">
channel_name
</code>
</span>
</dt>
<dd>
<p>
The name of the replication channel. The default
replication channel's name is the empty string
(
<span class="quote">
“
<span class="quote">
</span>
”
</span>
).
</p>
</dd>
<dt>
<span class="term">
<code class="literal">
relay_log_file
</code>
</span>
</dt>
<dd>
<p>
The name of the current relay log file for the
replication channel.
</p>
</dd>
<dt>
<span class="term">
<code class="literal">
relay_log_pos
</code>
</span>
</dt>
<dd>
<p>
The current relay log position at the time the
<code class="literal">
log_status
</code>
table was accessed.
</p>
</dd>
</dl>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STORAGE_ENGINES
</code>
</p>
<p>
Relevant information from individual storage engines,
provided as a JSON object with one key for each applicable
storage engine.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table has no
indexes.
</p>
<p>
The
<code class="literal">
BACKUP_ADMIN
</code>
privilege, as well as the
<code class="literal">
SELECT
</code>
privilege, is required for access to
the
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table.
</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-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stop-group-replication.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="stop-group-replication">
</a>
15.4.3.2 STOP GROUP_REPLICATION Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176807312">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa83991236"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STOP</span> <span class="token keyword">GROUP_REPLICATION</span></code></pre>
</div>
<p>
Stops Group Replication. This statement requires the
<a class="link" href="privileges-provided.html#priv_group-replication-admin">
<code class="literal">
GROUP_REPLICATION_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege). As soon as you issue
<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>
the member is set to
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only=ON
</code>
</a>
, which
ensures that no writes can be made to the member while Group
Replication stops. Any other asynchronous replication channels
running on the member are also stopped. Any user credentials
that you specified in the
<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 when starting Group
Replication on this member are removed from memory, and must be
supplied when you start Group Replication again.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Use this statement with extreme caution because it removes the
server instance from the group, meaning it is no longer
protected by Group Replication's consistency guarantee
mechanisms. To be completely safe, ensure that your
applications can no longer connect to the instance before
issuing this statement to avoid any chance of stale reads.
</p>
</div>
<p>
The
<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>
statement stops asynchronous replication channels on the group
member, but it does not implicitly commit transactions that are
in progress on them like
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
does. This is because on a Group Replication
group member, an additional transaction committed during the
shutdown operation would leave the member inconsistent with the
group and cause an issue with rejoining. To avoid failed commits
for transactions that are in progress while stopping Group
Replication, the
<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>
statement cannot be issued while a
GTID is assigned as the value of the
<code class="literal">
gtid_next
</code>
system variable.
</p>
<p>
The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_components_stop_timeout">
<code class="literal">
group_replication_components_stop_timeout
</code>
</a>
system variable specifies the time for which Group Replication
waits for each of its modules to complete ongoing processes
after this statement is issued. The timeout is used to resolve
situations in which Group Replication components cannot be
stopped normally, which can happen if the member is expelled
from the group while it is in an error state, or while a process
such as MySQL Enterprise Backup is holding a global lock on tables on the member.
In such situations, the member cannot stop the applier thread or
complete the distributed recovery process to rejoin.
<code class="literal">
STOP GROUP_REPLICATION
</code>
does not complete
until either the situation is resolved (for example, by the lock
being released), or the component timeout expires and the
modules are shut down regardless of their status. The default
value is 300 seconds; this means that Group Replication
components are stopped after 5 minutes if the situation is not
resolved before that time, allowing the member to be restarted
and rejoin.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-ft-index-cache-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-ft-index-cache-table">
</a>
28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076815632">
</a>
<p>
The
<a class="link" href="information-schema-innodb-ft-index-cache-table.html" title="28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table">
<code class="literal">
INNODB_FT_INDEX_CACHE
</code>
</a>
table
provides token information about newly inserted rows in a
<code class="literal">
FULLTEXT
</code>
index. To avoid expensive index
reorganization during DML operations, the information about newly
indexed words is stored separately, and combined with the main
search index only when
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE
TABLE
</code>
</a>
is run, when the server is shut down, or when the
cache size exceeds a limit defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_cache_size">
<code class="literal">
innodb_ft_cache_size
</code>
</a>
or
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_total_cache_size">
<code class="literal">
innodb_ft_total_cache_size
</code>
</a>
system
variable.
</p>
<p>
This table is empty initially. Before querying it, set the value
of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to the name (including the database name) of the table
that contains the
<code class="literal">
FULLTEXT
</code>
index (for example,
<code class="literal">
test/articles
</code>
).
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-fulltext_index-tables.html" title="17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables">
Section 17.15.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-innodb-ft-index-cache-table.html" title="28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table">
<code class="literal">
INNODB_FT_INDEX_CACHE
</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">
WORD
</code>
</p>
<p>
A word extracted from the text of a newly inserted row.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FIRST_DOC_ID
</code>
</p>
<p>
The first document ID in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LAST_DOC_ID
</code>
</p>
<p>
The last document ID in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOC_COUNT
</code>
</p>
<p>
The number of rows in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index. The same word can occur
several times within the cache table, once for each
combination of
<code class="literal">
DOC_ID
</code>
and
<code class="literal">
POSITION
</code>
values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOC_ID
</code>
</p>
<p>
The document ID of the newly inserted row. This value might
reflect the value of an ID column that you defined for the
underlying table, or it can be a sequence value generated by
<code class="literal">
InnoDB
</code>
when the table contains no suitable
column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
POSITION
</code>
</p>
<p>
The position of this particular instance of the word within
the relevant document identified by the
<code class="literal">
DOC_ID
</code>
value. The value does not represent
an absolute position; it is an offset added to the
<code class="literal">
POSITION
</code>
of the previous instance of that
word.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045076783040">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This table is empty initially. Before querying it, set the
value of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to the name (including the database name) of the
table that contains the
<code class="literal">
FULLTEXT
</code>
index (for
example
<code class="literal">
test/articles
</code>
). The following
example demonstrates how to use the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to show information about a
<code class="literal">
FULLTEXT
</code>
index for a specified table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67948665"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> articles <span class="token punctuation">(</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>
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>
body <span class="token datatype">TEXT</span><span class="token punctuation">,</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 punctuation">)</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">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 punctuation">(</span><span class="token string">'MySQL Tutorial'</span><span class="token punctuation">,</span><span class="token string">'DBMS stands for DataBase ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'How To Use MySQL Well'</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 punctuation">(</span><span class="token string">'Optimizing MySQL'</span><span class="token punctuation">,</span><span class="token string">'In this tutorial we show ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</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 punctuation">(</span><span class="token string">'MySQL vs. YourSQL'</span><span class="token punctuation">,</span><span class="token string">'In the following database comparison ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</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">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_ft_aux_table <span class="token operator">=</span> <span class="token string">'test/articles'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> WORD<span class="token punctuation">,</span> DOC_COUNT<span class="token punctuation">,</span> DOC_ID<span class="token punctuation">,</span> POSITION
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_FT_INDEX_CACHE <span class="token keyword">LIMIT</span> <span class="token number">5</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> WORD <span class="token punctuation">|</span> DOC_COUNT <span class="token punctuation">|</span> DOC_ID <span class="token punctuation">|</span> POSITION <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1001 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> after <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 22 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> comparison <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 44 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> configured <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> database <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 31 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
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>
<li class="listitem">
<p>
For more information about
<code class="literal">
InnoDB
</code>
<code class="literal">
FULLTEXT
</code>
search, see
<a class="xref" href="innodb-fulltext-index.html" title="17.6.2.4 InnoDB Full-Text Indexes">
Section 17.6.2.4, “InnoDB Full-Text Indexes”
</a>
, and
<a class="xref" href="fulltext-search.html" title="14.9 Full-Text Search Functions">
Section 14.9, “Full-Text Search Functions”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqlcheck.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysqlcheck">
</a>
6.5.3 mysqlcheck — A Table Maintenance Program
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045315949056">
</a>
<a class="indexterm" name="idm46045315948144">
</a>
<a class="indexterm" name="idm46045315946784">
</a>
<a class="indexterm" name="idm46045315945424">
</a>
<a class="indexterm" name="idm46045315944064">
</a>
<p>
The
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
client performs table
maintenance: It checks, repairs, optimizes, or analyzes tables.
</p>
<p>
Each table is locked and therefore unavailable to other sessions
while it is being processed, although for check operations, the
table is locked with a
<code class="literal">
READ
</code>
lock only (see
<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>
, for more information about
<code class="literal">
READ
</code>
and
<code class="literal">
WRITE
</code>
locks).
Table maintenance operations can be time-consuming, particularly
for large tables. If you use the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
or
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-databases">
<code class="option">
--all-databases
</code>
</a>
option to
process all tables in one or more databases, an invocation of
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
might take a long time. (This is
also true for the MySQL upgrade procedure if it determines that
table checking is needed because it processes tables the same
way.)
</p>
<p>
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
must be used when 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 running, which means that
you do not have to stop the server to perform table maintenance.
</p>
<p>
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
uses the SQL statements
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
,
<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>
, and
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
in a convenient
way for the user. It determines which statements to use for the
operation you want to perform, and then sends the statements to
the server to be executed. For details about which storage
engines each statement works with, see the descriptions for
those statements in
<a class="xref" href="table-maintenance-statements.html" title="15.7.3 Table Maintenance Statements">
Section 15.7.3, “Table Maintenance Statements”
</a>
.
</p>
<p>
All storage engines do not necessarily support all four
maintenance operations. In such cases, an error message is
displayed. For example, if
<code class="literal">
test.t
</code>
is an
<code class="literal">
MEMORY
</code>
table, an attempt to check it produces
this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa60776207"><div class="copy-help left">Press ⌘+C to 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">mysqlcheck</span> test t
test<span class="token punctuation">.</span>t
note <span class="token punctuation">:</span> The storage engine for the table doesn't support check</code></pre>
</div>
<p>
If
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
is unable to repair a table,
see
<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>
for manual table repair
strategies. This is the case, for example, for
<code class="literal">
InnoDB
</code>
tables, which can be checked with
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
, but not repaired
with
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
.
</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Caution
</div>
<p>
It is best to make a backup of a table before performing a
table repair operation; under some circumstances the operation
might cause data loss. Possible causes include but are not
limited to file system errors.
</p>
</div>
<p>
There are three general ways to invoke
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76327954"><div class="copy-help left">Press ⌘+C to 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">mysqlcheck <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">db_name</em> <span class="token punctuation">[</span><em class="replaceable">tbl_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
mysqlcheck <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <span class="token property">--databases</span> <em class="replaceable">db_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
mysqlcheck <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <span class="token property">--all-databases</span></code></pre>
</div>
<p>
If you do not name any tables following
<em class="replaceable">
<code>
db_name
</code>
</em>
or if you use the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
or
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-databases">
<code class="option">
--all-databases
</code>
</a>
option,
entire databases are checked.
</p>
<p>
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
has a special feature compared to
other client programs. The default behavior of checking tables
(
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check">
<code class="option">
--check
</code>
</a>
) can be changed by
renaming the binary. If you want to have a tool that repairs
tables by default, you should just make a copy of
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
named
<span class="command">
<strong>
mysqlrepair
</strong>
</span>
, or make a symbolic link to
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
named
<span class="command">
<strong>
mysqlrepair
</strong>
</span>
. If you invoke
<span class="command">
<strong>
mysqlrepair
</strong>
</span>
, it repairs tables.
</p>
<p>
The names shown in the following table can be used to change
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
default behavior.
</p>
<div class="informaltable">
<table summary="Command names that can be used to change mysqlcheck default behavior.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 75%"/>
</colgroup>
<thead>
<tr>
<th>
Command
</th>
<th>
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="command">
<strong>
mysqlrepair
</strong>
</span>
</td>
<td>
The default option is
<a class="link" href="mysqlcheck.html#option_mysqlcheck_repair">
<code class="option">
--repair
</code>
</a>
</td>
</tr>
<tr>
<td>
<span class="command">
<strong>
mysqlanalyze
</strong>
</span>
</td>
<td>
The default option is
<a class="link" href="mysqlcheck.html#option_mysqlcheck_analyze">
<code class="option">
--analyze
</code>
</a>
</td>
</tr>
<tr>
<td>
<span class="command">
<strong>
mysqloptimize
</strong>
</span>
</td>
<td>
The default option is
<a class="link" href="mysqlcheck.html#option_mysqlcheck_optimize">
<code class="option">
--optimize
</code>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<p>
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
supports the following options,
which can be specified on the command line or in the
<code class="literal">
[mysqlcheck]
</code>
and
<code class="literal">
[client]
</code>
groups of an option file. For information about option files
used by MySQL programs, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<div class="table">
<a name="idm46045315875328">
</a>
<p class="title">
<b>
Table 6.12 mysqlcheck Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for mysqlcheck.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-databases">
--all-databases
</a>
</td>
<td>
Check all tables in all databases
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-in-1">
--all-in-1
</a>
</td>
<td>
Execute a single statement for each database that names all the tables from that database
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_analyze">
--analyze
</a>
</td>
<td>
Analyze the tables
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_auto-repair">
--auto-repair
</a>
</td>
<td>
If a checked table is corrupted, automatically fix it
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_bind-address">
--bind-address
</a>
</td>
<td>
Use specified network interface to connect to MySQL Server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_character-sets-dir">
--character-sets-dir
</a>
</td>
<td>
Directory where character sets are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check">
--check
</a>
</td>
<td>
Check the tables for errors
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check-only-changed">
--check-only-changed
</a>
</td>
<td>
Check only tables that have changed since the last check
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check-upgrade">
--check-upgrade
</a>
</td>
<td>
Invoke CHECK TABLE with the FOR UPGRADE option
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_compress">
--compress
</a>
</td>
<td>
Compress all information sent between client and server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_compression-algorithms">
--compression-algorithms
</a>
</td>
<td>
Permitted compression algorithms for connections to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
--databases
</a>
</td>
<td>
Interpret all arguments as database names
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_debug">
--debug
</a>
</td>
<td>
Write debugging log
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_debug-check">
--debug-check
</a>
</td>
<td>
Print debugging information when program exits
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_debug-info">
--debug-info
</a>
</td>
<td>
Print debugging information, memory, and CPU statistics when program exits
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_default-auth">
--default-auth
</a>
</td>
<td>
Authentication plugin to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_default-character-set">
--default-character-set
</a>
</td>
<td>
Specify default character set
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_defaults-extra-file">
--defaults-extra-file
</a>
</td>
<td>
Read named option file in addition to usual option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_defaults-group-suffix">
--defaults-group-suffix
</a>
</td>
<td>
Option group suffix value
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_enable-cleartext-plugin">
--enable-cleartext-plugin
</a>
</td>
<td>
Enable cleartext authentication plugin
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_extended">
--extended
</a>
</td>
<td>
Check and repair tables
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_fast">
--fast
</a>
</td>
<td>
Check only tables that have not been closed properly
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_force">
--force
</a>
</td>
<td>
Continue even if an SQL error occurs
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_get-server-public-key">
--get-server-public-key
</a>
</td>
<td>
Request RSA public key from server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_help">
--help
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_host">
--host
</a>
</td>
<td>
Host on which MySQL server is located
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_login-path">
--login-path
</a>
</td>
<td>
Read login path options from .mylogin.cnf
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_medium-check">
--medium-check
</a>
</td>
<td>
Do a check that is faster than an --extended operation
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_no-login-paths">
--no-login-paths
</a>
</td>
<td>
Do not read login paths from the login path file
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_optimize">
--optimize
</a>
</td>
<td>
Optimize the tables
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
--password
</a>
</td>
<td>
Password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
--password1
</a>
</td>
<td>
First multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password2">
--password2
</a>
</td>
<td>
Second multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password3">
--password3
</a>
</td>
<td>
Third multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_pipe">
--pipe
</a>
</td>
<td>
Connect to server using named pipe (Windows only)
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_plugin-dir">
--plugin-dir
</a>
</td>
<td>
Directory where plugins are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_port">
--port
</a>
</td>
<td>
TCP/IP port number for connection
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_print-defaults">
--print-defaults
</a>
</td>
<td>
Print default options
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_protocol">
--protocol
</a>
</td>
<td>
Transport protocol to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_quick">
--quick
</a>
</td>
<td>
The fastest method of checking
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_repair">
--repair
</a>
</td>
<td>
Perform a repair that can fix almost anything except unique keys that are not unique
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_server-public-key-path">
--server-public-key-path
</a>
</td>
<td>
Path name to file containing RSA public key
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_shared-memory-base-name">
--shared-memory-base-name
</a>
</td>
<td>
Shared-memory name for shared-memory connections (Windows only)
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_silent">
--silent
</a>
</td>
<td>
Silent mode
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_skip-database">
--skip-database
</a>
</td>
<td>
Omit this database from performed operations
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_socket">
--socket
</a>
</td>
<td>
Unix socket file or Windows named pipe to use
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-ca
</a>
</td>
<td>
File that contains list of trusted SSL Certificate Authorities
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-capath
</a>
</td>
<td>
Directory that contains trusted SSL Certificate Authority certificate files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-cert
</a>
</td>
<td>
File that contains X.509 certificate
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-cipher
</a>
</td>
<td>
Permissible ciphers for connection encryption
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-crl
</a>
</td>
<td>
File that contains certificate revocation lists
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-crlpath
</a>
</td>
<td>
Directory that contains certificate revocation-list files
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
--ssl-fips-mode
</a>
</td>
<td>
Whether to enable FIPS mode on client side
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-key
</a>
</td>
<td>
File that contains X.509 key
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-mode
</a>
</td>
<td>
Desired security state of connection to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-session-data
</a>
</td>
<td>
File that contains SSL session data
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl">
--ssl-session-data-continue-on-failed-reuse
</a>
</td>
<td>
Whether to establish connections if session reuse fails
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tables">
--tables
</a>
</td>
<td>
Overrides the --databases or -B option
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-ciphersuites">
--tls-ciphersuites
</a>
</td>
<td>
Permissible TLSv1.3 ciphersuites for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-sni-servername">
--tls-sni-servername
</a>
</td>
<td>
Server name supplied by the client
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-version">
--tls-version
</a>
</td>
<td>
Permissible TLS protocols for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_use-frm">
--use-frm
</a>
</td>
<td>
For repair operations on MyISAM tables
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_user">
--user
</a>
</td>
<td>
MySQL user name to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_verbose">
--verbose
</a>
</td>
<td>
Verbose mode
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_version">
--version
</a>
</td>
<td>
Display version information and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_write-binlog">
--write-binlog
</a>
</td>
<td>
Log ANALYZE, OPTIMIZE, REPAIR statements to binary log. --skip-write-binlog adds NO_WRITE_TO_BINLOG to these statements
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_zstd-compression-level">
--zstd-compression-level
</a>
</td>
<td>
Compression level for connections to server that use zstd compression
</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: 260.906px;">
Option Name
</th>
<th style="width: 477.094px;">
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">
<p>
<a name="option_mysqlcheck_help">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315673440">
</a>
<a class="indexterm" name="idm46045315671952">
</a>
<p>
Display a help message and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_all-databases">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-databases">
<code class="option">
--all-databases
</code>
</a>
,
<code class="option">
-A
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for all-databases">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--all-databases
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315661872">
</a>
<a class="indexterm" name="idm46045315660384">
</a>
<p>
Check all tables in all databases. This is the same as using
the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
option
and naming all the databases on the command line, except
that the
<code class="literal">
INFORMATION_SCHEMA
</code>
and
<code class="literal">
performance_schema
</code>
databases are not
checked. They can be checked by explicitly naming them with
the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_all-in-1">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_all-in-1">
<code class="option">
--all-in-1
</code>
</a>
,
<code class="option">
-1
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for all-in-1">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--all-in-1
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315646640">
</a>
<a class="indexterm" name="idm46045315645152">
</a>
<p>
Instead of issuing a statement for each table, execute a
single statement for each database that names all the tables
from that database to be processed.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_analyze">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_analyze">
<code class="option">
--analyze
</code>
</a>
,
<code class="option">
-a
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for analyze">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--analyze
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315635008">
</a>
<a class="indexterm" name="idm46045315633520">
</a>
<p>
Analyze the tables.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_auto-repair">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_auto-repair">
<code class="option">
--auto-repair
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for auto-repair">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--auto-repair
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315623920">
</a>
<a class="indexterm" name="idm46045315622432">
</a>
<p>
If a checked table is corrupted, automatically fix it. Any
necessary repairs are done after all tables have been
checked.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_bind-address">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_bind-address">
<code class="option">
--bind-address=
<em class="replaceable">
<code>
ip_address
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for bind-address">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--bind-address=ip_address
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315612352">
</a>
<a class="indexterm" name="idm46045315610864">
</a>
<p>
On a computer having multiple network interfaces, use this
option to select which interface to use for connecting to
the MySQL server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_character-sets-dir">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_character-sets-dir">
<code class="option">
--character-sets-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315598736">
</a>
<a class="indexterm" name="idm46045315597232">
</a>
<p>
The directory where character sets are installed. 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>
<a name="option_mysqlcheck_check">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check">
<code class="option">
--check
</code>
</a>
,
<code class="option">
-c
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--check
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315586528">
</a>
<a class="indexterm" name="idm46045315585040">
</a>
<p>
Check the tables for errors. This is the default operation.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_check-only-changed">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check-only-changed">
<code class="option">
--check-only-changed
</code>
</a>
,
<code class="option">
-C
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for check-only-changed">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--check-only-changed
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315574944">
</a>
<a class="indexterm" name="idm46045315573440">
</a>
<p>
Check only tables that have changed since the last check or
that have not been closed properly.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_check-upgrade">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_check-upgrade">
<code class="option">
--check-upgrade
</code>
</a>
,
<code class="option">
-g
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for check-upgrade">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--check-upgrade
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315563280">
</a>
<a class="indexterm" name="idm46045315561792">
</a>
<p>
Invoke
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
with the
<code class="literal">
FOR UPGRADE
</code>
option to check tables for
incompatibilities with the current version of the server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_compress">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_compress">
<code class="option">
--compress
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compress">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compress[={OFF|ON}]
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315543616">
</a>
<a class="indexterm" name="idm46045315542128">
</a>
<p>
Compress all information sent between the client and the
server if possible. 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>
This option is deprecated. Expect it to be removed in a
future version of MySQL. See
<a class="xref" href="connection-compression-control.html#connection-compression-legacy-configuration" title="Configuring Legacy Connection Compression">
Configuring Legacy Connection Compression
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_compression-algorithms">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_compression-algorithms">
<code class="option">
--compression-algorithms=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compression-algorithms">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compression-algorithms=value
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Set
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
uncompressed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
zlib
</code>
</p>
<p class="valid-value">
<code class="literal">
zstd
</code>
</p>
<p class="valid-value">
<code class="literal">
uncompressed
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315520816">
</a>
<a class="indexterm" name="idm46045315519312">
</a>
<p>
The permitted compression algorithms for connections to the
server. The available algorithms are the same as for the
<a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
<code class="literal">
protocol_compression_algorithms
</code>
</a>
system variable. The default value is
<code class="literal">
uncompressed
</code>
.
</p>
<p>
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>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_databases">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
,
<code class="option">
-B
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for databases">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--databases
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315505984">
</a>
<a class="indexterm" name="idm46045315504496">
</a>
<p>
Process all tables in the named databases. Normally,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
treats the first name argument
on the command line as a database name and any following
names as table names. With this option, it treats all name
arguments as database names.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_debug">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315487680">
</a>
<a class="indexterm" name="idm46045315486192">
</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
</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_mysqlcheck_debug-check">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_debug-check">
<code class="option">
--debug-check
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug-check
</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="idm46045315467904">
</a>
<a class="indexterm" name="idm46045315466416">
</a>
<p>
Print some debugging information when the program exits.
</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_mysqlcheck_debug-info">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_debug-info">
<code class="option">
--debug-info
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug-info">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug-info
</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="idm46045315450304">
</a>
<a class="indexterm" name="idm46045315448816">
</a>
<p>
Print debugging information and memory and CPU usage
statistics when the program exits.
</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_mysqlcheck_default-character-set">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_default-character-set">
<code class="option">
--default-character-set=
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for default-character-set">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--default-character-set=charset_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315434784">
</a>
<a class="indexterm" name="idm46045315433280">
</a>
<p>
Use
<em class="replaceable">
<code>
charset_name
</code>
</em>
as the default
character set. 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>
<a name="option_mysqlcheck_defaults-extra-file">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315420144">
</a>
<a class="indexterm" name="idm46045315418640">
</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_mysqlcheck_defaults-file">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315404736">
</a>
<a class="indexterm" name="idm46045315403248">
</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>
Exception: Even with
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
, client
programs read
<code class="filename">
.mylogin.cnf
</code>
.
</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_mysqlcheck_defaults-group-suffix">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315387280">
</a>
<a class="indexterm" name="idm46045315385776">
</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="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
normally reads the
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysqlcheck]
</code>
groups. If this option is
given as
<a class="link" href="mysqlcheck.html#option_mysqlcheck_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=_other
</code>
</a>
,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
also reads the
<code class="literal">
[client_other]
</code>
and
<code class="literal">
[mysqlcheck_other]
</code>
groups.
</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_mysqlcheck_extended">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_extended">
<code class="option">
--extended
</code>
</a>
,
<code class="option">
-e
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for extended">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--extended
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315367552">
</a>
<a class="indexterm" name="idm46045315366064">
</a>
<p>
If you are using this option to check tables, it ensures
that they are 100% consistent but takes a long time.
</p>
<p>
If you are using this option to repair tables, it runs an
extended repair that may not only take a long time to
execute, but may produce a lot of garbage rows also!
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_default-auth">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_default-auth">
<code class="option">
--default-auth=
<em class="replaceable">
<code>
plugin
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for default-auth">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--default-auth=plugin
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315353424">
</a>
<a class="indexterm" name="idm46045315351936">
</a>
<p>
A hint about which client-side authentication plugin to use.
See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_enable-cleartext-plugin">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_enable-cleartext-plugin">
<code class="option">
--enable-cleartext-plugin
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for enable-cleartext-plugin">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--enable-cleartext-plugin
</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="idm46045315336880">
</a>
<a class="indexterm" name="idm46045315335376">
</a>
<p>
Enable the
<code class="literal">
mysql_clear_password
</code>
cleartext
authentication plugin. (See
<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>
.)
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_fast">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_fast">
<code class="option">
--fast
</code>
</a>
,
<code class="option">
-F
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for fast">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--fast
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315323984">
</a>
<a class="indexterm" name="idm46045315322496">
</a>
<p>
Check only tables that have not been closed properly.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_force">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_force">
<code class="option">
--force
</code>
</a>
,
<code class="option">
-f
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for force">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--force
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315312480">
</a>
<a class="indexterm" name="idm46045315310992">
</a>
<p>
Continue even if an SQL error occurs.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_get-server-public-key">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for get-server-public-key">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--get-server-public-key
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315299280">
</a>
<a class="indexterm" name="idm46045315297776">
</a>
<p>
Request from the server the public key required for RSA key
pair-based password exchange. This option applies to clients
that authenticate with the
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. For that plugin, the server does not send the public
key unless requested. This option is ignored for accounts
that do not authenticate with that plugin. It is also
ignored if RSA-based password exchange is not used, as is
the case when the client connects to the server using a
secure connection.
</p>
<p>
If
<a class="link" href="mysqlcheck.html#option_mysqlcheck_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="mysqlcheck.html#option_mysqlcheck_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
For information about the
<code class="literal">
caching_sha2_password
</code>
plugin, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_host">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_host">
<code class="option">
--host=
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</a>
,
<code class="option">
-h
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--host=host_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
localhost
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315276720">
</a>
<a class="indexterm" name="idm46045315275232">
</a>
<p>
Connect to the MySQL server on the given host.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_login-path">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_login-path">
<code class="option">
--login-path=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315263232">
</a>
<a class="indexterm" name="idm46045315261744">
</a>
<p>
Read options from the named login path in the
<code class="filename">
.mylogin.cnf
</code>
login path file. A
<span class="quote">
“
<span class="quote">
login path
</span>
”
</span>
is an option group containing
options that specify which MySQL server to connect to and
which account to authenticate as. To create or modify a
login path file, 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_mysqlcheck_no-login-paths">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315247600">
</a>
<a class="indexterm" name="idm46045315246112">
</a>
<p>
Skips reading options from the login path file.
</p>
<p>
See
<a class="link" href="mysql-command-options.html#option_mysql_login-path">
<code class="option">
--login-path
</code>
</a>
for related
information.
</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_mysqlcheck_medium-check">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_medium-check">
<code class="option">
--medium-check
</code>
</a>
,
<code class="option">
-m
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for medium-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--medium-check
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315233456">
</a>
<a class="indexterm" name="idm46045315231968">
</a>
<p>
Do a check that is faster than an
<a class="link" href="mysqlcheck.html#option_mysqlcheck_extended">
<code class="option">
--extended
</code>
</a>
operation.
This finds only 99.99% of all errors, which should be good
enough in most cases.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_no-defaults">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315221200">
</a>
<a class="indexterm" name="idm46045315219712">
</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="mysqlcheck.html#option_mysqlcheck_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="mysqlcheck.html#option_mysqlcheck_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_mysqlcheck_optimize">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_optimize">
<code class="option">
--optimize
</code>
</a>
,
<code class="option">
-o
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for optimize">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--optimize
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315202352">
</a>
<a class="indexterm" name="idm46045315200864">
</a>
<p>
Optimize the tables.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_password">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
<code class="option">
--password[=
<em class="replaceable">
<code>
password
</code>
</em>
]
</code>
</a>
,
<code class="option">
-p[
<em class="replaceable">
<code>
password
</code>
</em>
]
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315187936">
</a>
<a class="indexterm" name="idm46045315186448">
</a>
<p>
The password of the MySQL account used for connecting to the
server. The password value is optional. If not given,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
prompts for one. If given,
there must be
<span class="emphasis">
<em>
no space
</em>
</span>
between
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
<code class="option">
--password=
</code>
</a>
or
<code class="option">
-p
</code>
and the password following it. If no
password option is specified, the default is to send no
password.
</p>
<p>
Specifying a password on the command line should be
considered insecure. To avoid giving the password on the
command line, use an option file. See
<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>
.
</p>
<p>
To explicitly specify that there is no password and that
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
should not prompt for one, use
the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
<code class="option">
--skip-password
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_password1">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--password1[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045315174512">
</a>
<p>
The password for multifactor authentication factor 1 of the
MySQL account used for connecting to the server. The
password value is optional. If not given,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
prompts for one. If given,
there must be
<span class="emphasis">
<em>
no space
</em>
</span>
between
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--password1=
</code>
</a>
and the
password following it. If no password option is specified,
the default is to send no password.
</p>
<p>
Specifying a password on the command line should be
considered insecure. To avoid giving the password on the
command line, use an option file. See
<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>
.
</p>
<p>
To explicitly specify that there is no password and that
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
should not prompt for one, use
the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--skip-password1
</code>
</a>
option.
</p>
<p>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--password1
</code>
</a>
and
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
<code class="option">
--password
</code>
</a>
are
synonymous, as are
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--skip-password1
</code>
</a>
and
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password">
<code class="option">
--skip-password
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_password2">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password2">
<code class="option">
--password2[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045315158960">
</a>
<p>
The password for multifactor authentication factor 2 of the
MySQL account used for connecting to the server. The
semantics of this option are similar to the semantics for
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--password1
</code>
</a>
; see the
description of that option for details.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_password3">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password3">
<code class="option">
--password3[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<a class="indexterm" name="idm46045315153600">
</a>
<p>
The password for multifactor authentication factor 3 of the
MySQL account used for connecting to the server. The
semantics of this option are similar to the semantics for
<a class="link" href="mysqlcheck.html#option_mysqlcheck_password1">
<code class="option">
--password1
</code>
</a>
; see the
description of that option for details.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_pipe">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_pipe">
<code class="option">
--pipe
</code>
</a>
,
<code class="option">
-W
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for pipe">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--pipe
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315140800">
</a>
<a class="indexterm" name="idm46045315139312">
</a>
<p>
On Windows, connect to the server using a named pipe. This
option applies only if the server was started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable
enabled to support named-pipe connections. In addition, the
user making the connection must be a member of the Windows
group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_plugin-dir">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_plugin-dir">
<code class="option">
--plugin-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for plugin-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--plugin-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315124496">
</a>
<a class="indexterm" name="idm46045315123008">
</a>
<p>
The directory in which to look for plugins. Specify this
option if the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_default-auth">
<code class="option">
--default-auth
</code>
</a>
option is
used to specify an authentication plugin but
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
does not find it. See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_port">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
,
<code class="option">
-P
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for port">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--port=port_num
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
3306
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315104880">
</a>
<a class="indexterm" name="idm46045315103392">
</a>
<p>
For TCP/IP connections, the port number to use.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_print-defaults">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045315093728">
</a>
<a class="indexterm" name="idm46045315092240">
</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_mysqlcheck_protocol">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_protocol">
<code class="option">
--protocol={TCP|SOCKET|PIPE|MEMORY}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for protocol">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--protocol=type
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[see text]
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
TCP
</code>
</p>
<p class="valid-value">
<code class="literal">
SOCKET
</code>
</p>
<p class="valid-value">
<code class="literal">
PIPE
</code>
</p>
<p class="valid-value">
<code class="literal">
MEMORY
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315071168">
</a>
<a class="indexterm" name="idm46045315069680">
</a>
<p>
The transport protocol to use for connecting to the server.
It is useful when the other connection parameters normally
result in use of a protocol other than the one you want. For
details on the permissible values, see
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_quick">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_quick">
<code class="option">
--quick
</code>
</a>
,
<code class="option">
-q
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for quick">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--quick
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315058784">
</a>
<a class="indexterm" name="idm46045315057296">
</a>
<p>
If you are using this option to check tables, it prevents
the check from scanning the rows to check for incorrect
links. This is the fastest check method.
</p>
<p>
If you are using this option to repair tables, it tries to
repair only the index tree. This is the fastest repair
method.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_repair">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_repair">
<code class="option">
--repair
</code>
</a>
,
<code class="option">
-r
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for repair">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--repair
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315046464">
</a>
<a class="indexterm" name="idm46045315044976">
</a>
<p>
Perform a repair that can fix almost anything except unique
keys that are not unique.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_server-public-key-path">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for server-public-key-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--server-public-key-path=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315032800">
</a>
<a class="indexterm" name="idm46045315031296">
</a>
<p>
The path name to a file in PEM format containing a
client-side copy of the public key required by the server
for RSA key pair-based password exchange. This option
applies to clients that authenticate with the
<code class="literal">
sha256_password
</code>
(deprecated) or
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. This option is ignored for accounts that do not
authenticate with one of those plugins. It is also ignored
if RSA-based password exchange is not used, as is the case
when the client connects to the server using a secure
connection.
</p>
<p>
If
<a class="link" href="mysqlcheck.html#option_mysqlcheck_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="mysqlcheck.html#option_mysqlcheck_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
For
<code class="literal">
sha256_password
</code>
(deprecated), this
option applies only if MySQL was built using OpenSSL.
</p>
<p>
For information about the
<code class="literal">
sha256_password
</code>
and
<code class="literal">
caching_sha2_password
</code>
plugins, see
<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>
, and
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_shared-memory-base-name">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_shared-memory-base-name">
<code class="option">
--shared-memory-base-name=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for shared-memory-base-name">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--shared-memory-base-name=name
</code>
</td>
</tr>
<tr>
<th>
Platform Specific
</th>
<td>
Windows
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045315009856">
</a>
<a class="indexterm" name="idm46045315008352">
</a>
<p>
On Windows, the shared-memory name to use for connections
made using shared memory to a local server. The default
value is
<code class="literal">
MYSQL
</code>
. The shared-memory name is
case-sensitive.
</p>
<p>
This option applies only if the server was started with the
<a class="link" href="server-system-variables.html#sysvar_shared_memory">
<code class="literal">
shared_memory
</code>
</a>
system
variable enabled to support shared-memory connections.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_silent">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045314995648">
</a>
<a class="indexterm" name="idm46045314994160">
</a>
<p>
Silent mode. Print only error messages.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_skip-database">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_skip-database">
<code class="option">
--skip-database=
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-database=db_name
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314984320">
</a>
<a class="indexterm" name="idm46045314982832">
</a>
<p>
Do not include the named database (case-sensitive) in the
operations performed by
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_socket">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_socket">
<code class="option">
--socket=
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</a>
,
<code class="option">
-S
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for socket">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--socket={file_name|pipe_name}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314968848">
</a>
<a class="indexterm" name="idm46045314967360">
</a>
<p>
For connections to
<code class="literal">
localhost
</code>
, the Unix
socket file to use, or, on Windows, the name of the named
pipe to use.
</p>
<p>
On Windows, this option applies only if the server was
started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable enabled to support named-pipe connections.
In addition, the user making the connection must be a member
of the Windows group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_ssl">
</a>
<code class="option">
--ssl*
</code>
</p>
<a class="indexterm" name="idm46045314959776">
</a>
<a class="indexterm" name="idm46045314958288">
</a>
<p>
Options that begin with
<code class="option">
--ssl
</code>
specify
whether to connect to the server using encryption and
indicate where to find SSL keys and certificates. See
<a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
Command Options for Encrypted Connections
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_ssl-fips-mode">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
<code class="option">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-fips-mode">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
OFF
</code>
</p>
<p class="valid-value">
<code class="literal">
ON
</code>
</p>
<p class="valid-value">
<code class="literal">
STRICT
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314936144">
</a>
<a class="indexterm" name="idm46045314934656">
</a>
<p>
Controls whether to enable FIPS mode on the client side. The
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
option
differs from other
<code class="option">
--ssl-
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
options in that it is not used to establish encrypted
connections, but rather to affect which cryptographic
operations to permit. See
<a class="xref" href="fips-mode.html" title="8.8 FIPS Support">
Section 8.8, “FIPS Support”
</a>
.
</p>
<p>
These
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
values are permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
OFF
</code>
: Disable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ON
</code>
: Enable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STRICT
</code>
: Enable
<span class="quote">
“
<span class="quote">
strict
</span>
”
</span>
FIPS mode.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the OpenSSL FIPS Object Module is not available, the
only permitted value for
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
is
<code class="literal">
OFF
</code>
. In this case, setting
<a class="link" href="mysqlcheck.html#option_mysqlcheck_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
to
<code class="literal">
ON
</code>
or
<code class="literal">
STRICT
</code>
causes
the client to produce a warning at startup and to operate
in non-FIPS mode.
</p>
</div>
<p>
This option is deprecated. Expect it to be removed in a
future version of MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_tables">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tables">
<code class="option">
--tables
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tables
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314910016">
</a>
<a class="indexterm" name="idm46045314908528">
</a>
<p>
Override the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_databases">
<code class="option">
--databases
</code>
</a>
or
<code class="option">
-B
</code>
option. All name arguments following
the option are regarded as table names.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_tls-ciphersuites">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-ciphersuites">
<code class="option">
--tls-ciphersuites=
<em class="replaceable">
<code>
ciphersuite_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-ciphersuites">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-ciphersuites=ciphersuite_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314895104">
</a>
<a class="indexterm" name="idm46045314893616">
</a>
<p>
The permissible ciphersuites for encrypted connections that
use TLSv1.3. The value is a list of one or more
colon-separated ciphersuite names. The ciphersuites that can
be named for this option depend on the SSL library used to
compile MySQL. For details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_tls-sni-servername">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-sni-servername">
<code class="option">
--tls-sni-servername=
<em class="replaceable">
<code>
server_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-sni-servername">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-sni-servername=server_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314880624">
</a>
<a class="indexterm" name="idm46045314879120">
</a>
<p>
When specified, the name is passed to the
<code class="literal">
libmysqlclient
</code>
C API library using the
<code class="literal">
MYSQL_OPT_TLS_SNI_SERVERNAME
</code>
option of
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
. The server
name is not case-sensitive. To show which server name the
client specified for the current session, if any, check the
<a class="link" href="server-status-variables.html#statvar_Tls_sni_server_name">
<code class="literal">
Tls_sni_server_name
</code>
</a>
status
variable.
</p>
<p>
Server Name Indication (SNI) is an extension to the TLS
protocol (OpenSSL must be compiled using TLS extensions for
this option to function). The MySQL implementation of SNI
represents the client-side only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_tls-version">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_tls-version">
<code class="option">
--tls-version=
<em class="replaceable">
<code>
protocol_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-version=protocol_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
</code>
(OpenSSL 1.1.1 or higher)
</p>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2
</code>
(otherwise)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314858176">
</a>
<a class="indexterm" name="idm46045314856688">
</a>
<p>
The permissible TLS protocols for encrypted connections. The
value is a list of one or more comma-separated protocol
names. The protocols that can be named for this option
depend on the SSL library used to compile MySQL. For
details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_use-frm">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_use-frm">
<code class="option">
--use-frm
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for use-frm">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--use-frm
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314846048">
</a>
<a class="indexterm" name="idm46045314844560">
</a>
<p>
For repair operations on
<code class="literal">
MyISAM
</code>
tables,
get the table structure from the data dictionary so that the
table can be repaired even if the
<code class="filename">
.MYI
</code>
header is corrupted.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_user">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_user">
<code class="option">
--user=
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</a>
,
<code class="option">
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for user">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--user=user_name,
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314830432">
</a>
<a class="indexterm" name="idm46045314828944">
</a>
<p>
The user name of the MySQL account to use for connecting to
the server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_verbose">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045314818784">
</a>
<a class="indexterm" name="idm46045314817296">
</a>
<p>
Verbose mode. Print information about the various stages of
program operation.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_version">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_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="idm46045314807184">
</a>
<a class="indexterm" name="idm46045314805696">
</a>
<p>
Display version information and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_write-binlog">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_write-binlog">
<code class="option">
--write-binlog
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for write-binlog">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--write-binlog
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314796080">
</a>
<a class="indexterm" name="idm46045314794592">
</a>
<p>
This option is enabled by default, so that
<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>
, and
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
statements
generated by
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
are written to
the binary log. Use
<a class="link" href="mysqlcheck.html#option_mysqlcheck_write-binlog">
<code class="option">
--skip-write-binlog
</code>
</a>
to cause
<code class="literal">
NO_WRITE_TO_BINLOG
</code>
to be added
to the statements so that they are not logged. Use the
<a class="link" href="mysqlcheck.html#option_mysqlcheck_write-binlog">
<code class="option">
--skip-write-binlog
</code>
</a>
when these statements should not be sent to replicas or run
when using the binary logs for recovery from backup.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysqlcheck_zstd-compression-level">
</a>
<a class="link" href="mysqlcheck.html#option_mysqlcheck_zstd-compression-level">
<code class="option">
--zstd-compression-level=
<em class="replaceable">
<code>
level
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for zstd-compression-level">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--zstd-compression-level=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045314774528">
</a>
<a class="indexterm" name="idm46045314773024">
</a>
<p>
The compression level to use for connections to the server
that use the
<code class="literal">
zstd
</code>
compression algorithm.
The permitted levels are from 1 to 22, with larger values
indicating increasing levels of compression. The default
<code class="literal">
zstd
</code>
compression level is 3. The
compression level setting has no effect on connections that
do not use
<code class="literal">
zstd
</code>
compression.
</p>
<p>
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>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimize-benchmarking.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimize-benchmarking">
</a>
10.13 Measuring Performance (Benchmarking)
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045222096432">
</a>
<p>
To measure performance, consider the following factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Whether you are measuring the speed of a single operation on a
quiet system, or how a set of operations (a
<span class="quote">
“
<span class="quote">
workload
</span>
”
</span>
) works over a period of time. With
simple tests, you usually test how changing one aspect (a
configuration setting, the set of indexes on a table, the SQL
clauses in a query) affects performance. Benchmarks are
typically long-running and elaborate performance tests, where
the results could dictate high-level choices such as hardware
and storage configuration, or how soon to upgrade to a new
MySQL version.
</p>
</li>
<li class="listitem">
<p>
For benchmarking, sometimes you must simulate a heavy database
workload to get an accurate picture.
</p>
</li>
<li class="listitem">
<p>
Performance can vary depending on so many different factors
that a difference of a few percentage points might not be a
decisive victory. The results might shift the opposite way
when you test in a different environment.
</p>
</li>
<li class="listitem">
<p>
Certain MySQL features help or do not help performance
depending on the workload. For completeness, always test
performance with those features turned on and turned off. The
most important feature to try with each workload is the
<a class="link" href="innodb-adaptive-hash.html" title="17.5.3 Adaptive Hash Index">
adaptive hash
index
</a>
for
<code class="literal">
InnoDB
</code>
tables.
</p>
</li>
</ul>
</div>
<p>
This section progresses from simple and direct measurement
techniques that a single developer can do, to more complicated
ones that require additional expertise to perform and interpret
the results.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-cpudata-50ms.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-cpudata-50ms">
</a>
25.6.17.17 The ndbinfo cpudata_50ms Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089984016">
</a>
<p>
The
<code class="literal">
cpudata_50ms
</code>
table provides data about
CPU usage per 50-millisecond interval over the last second.
</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="idm46045089960640">
</a>
Notes
</h5>
<p>
The
<code class="literal">
cpudata_50ms
</code>
table is available only on
Linux and Solaris operating systems.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/persisted-system-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="persisted-system-variables">
</a>
7.1.9.3 Persisted System Variables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045263903936">
</a>
<a class="indexterm" name="idm46045263902448">
</a>
<a class="indexterm" name="idm46045263900960">
</a>
<a class="indexterm" name="idm46045263899472">
</a>
<a class="indexterm" name="idm46045263898400">
</a>
<a class="indexterm" name="idm46045263897312">
</a>
<a class="indexterm" name="idm46045263895824">
</a>
<a class="indexterm" name="idm46045263894736">
</a>
<p>
The MySQL server maintains system variables that configure its
operation. A system variable can have a global value that
affects server operation as a whole, a session value that
affects the current session, or both. Many system variables are
dynamic and can be changed at runtime using the
<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 affect operation of the current server instance.
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
can
also be used to persist certain global system variables to the
<code class="filename">
mysqld-auto.cnf
</code>
file in the data directory,
to affect server operation for subsequent startups.
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
removes persisted
settings from
<code class="filename">
mysqld-auto.cnf
</code>
.
</p>
<p>
The following discussion describes aspects of persisting system
variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-overview" title="Overview of Persisted System Variables">
Overview of Persisted System Variables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-syntax" title="Syntax for Persisting System Variables">
Syntax for Persisting System Variables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-information" title="Obtaining Information About Persisted System Variables">
Obtaining Information About Persisted System Variables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-file-handling" title="Format and Server Handling of the mysqld-auto.cnf File">
Format and Server Handling of the mysqld-auto.cnf File
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-sensitive" title="Persisting Sensitive System Variables">
Persisting Sensitive System Variables
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="persisted-system-variables-overview">
</a>
Overview of Persisted System Variables
</h5>
</div>
</div>
</div>
<p>
The capability of persisting global system variables at
runtime enables server configuration that persists across
server startups. Although many system variables can be set at
startup from a
<code class="filename">
my.cnf
</code>
option file, or at
runtime using the
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement, those methods of configuring the server either
require login access to the server host, or do not provide the
capability of persistently configuring the server at runtime
or remotely:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Modifying an option file requires direct access to that
file, which requires login access to the MySQL server
host. This is not always convenient.
</p>
</li>
<li class="listitem">
<p>
Modifying system variables with
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
is a runtime capability that can be done
from clients run locally or from remote hosts, but the
changes affect only the currently running server instance.
The settings are not persistent and do not carry over to
subsequent server startups.
</p>
</li>
</ul>
</div>
<p>
To augment administrative capabilities for server
configuration beyond what is achievable by editing option
files or 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>
, MySQL provides variants of
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
syntax that persist system variable settings to a file named
<code class="filename">
mysqld-auto.cnf
</code>
file in the data
directory. Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74758029"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> max_connections <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@PERSIST.max_connections</span> <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token keyword">PERSIST_ONLY</span> back_log <span class="token operator">=</span> <span class="token number">100</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@PERSIST_ONLY.back_log</span> <span class="token operator">=</span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL also provides a
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET
PERSIST
</code>
</a>
statement for removing persisted system
variables from
<code class="filename">
mysqld-auto.cnf
</code>
.
</p>
<p>
Server configuration performed by persisting system variables
has these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Persisted settings are made at runtime.
</p>
</li>
<li class="listitem">
<p>
Persisted settings are permanent. They apply across server
restarts.
</p>
</li>
<li class="listitem">
<p>
Persisted settings can be made from local clients or
clients who connect from a remote host. This provides the
convenience of remotely configuring multiple MySQL servers
from a central client host.
</p>
</li>
<li class="listitem">
<p>
To persist system variables, you need not have login
access to the MySQL server host or file system access to
option files. Ability to persist settings is controlled
using the MySQL privilege system. 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>
</li>
<li class="listitem">
<p>
An administrator with sufficient privileges can
reconfigure a server by persisting system variables, then
cause the server to use the changed settings immediately
by executing a
<a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
<code class="literal">
RESTART
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
Persisted settings provide immediate feedback about
errors. An error in a manually entered setting might not
be discovered until much later.
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statements that persist system variables avoid the
possibility of malformed settings because settings with
syntax errors do not succeed and do not change server
configuration.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="persisted-system-variables-syntax">
</a>
Syntax for Persisting System Variables
</h5>
</div>
</div>
</div>
<p>
These
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
syntax options are available for persisting system variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To persist a global system variable to the
<code class="filename">
mysqld-auto.cnf
</code>
option file in the
data directory, precede the variable name by the
<code class="literal">
PERSIST
</code>
keyword or the
<code class="literal">
@@PERSIST.
</code>
qualifier:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94478251"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> max_connections <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@PERSIST.max_connections</span> <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Like
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
,
<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 the global variable runtime value,
but also writes the variable setting to the
<code class="filename">
mysqld-auto.cnf
</code>
file (replacing any
existing variable setting if there is one).
</p>
</li>
<li class="listitem">
<p>
To persist a global system variable to the
<code class="filename">
mysqld-auto.cnf
</code>
file without setting
the global variable runtime value, precede the 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="sa39996316"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> back_log <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@@PERSIST_ONLY.back_log</span> <span class="token operator">=</span> <span class="token number">1000</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Like
<code class="literal">
PERSIST
</code>
,
<code class="literal">
PERSIST_ONLY
</code>
writes the variable
setting to
<code class="filename">
mysqld-auto.cnf
</code>
. However,
unlike
<code class="literal">
PERSIST
</code>
,
<code class="literal">
PERSIST_ONLY
</code>
does not modify the global
variable runtime value. This makes
<code class="literal">
PERSIST_ONLY
</code>
suitable for configuring
read-only system variables that can be set only at server
startup.
</p>
</li>
</ul>
</div>
<p>
For more information about
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
,
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>
<p>
These
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
syntax
options are available for removing persisted system variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To remove all persisted variables from
<code class="filename">
mysqld-auto.cnf
</code>
, use
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
without
naming any system variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa50882281"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">PERSIST</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To remove a specific persisted variable from
<code class="filename">
mysqld-auto.cnf
</code>
, name it in the
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31590065"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">PERSIST</span> <em class="replaceable">system_var_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
This includes plugin system variables, even if the plugin
is not currently installed. If the variable is not present
in the file, an error occurs.
</p>
</li>
<li class="listitem">
<p>
To remove a specific persisted variable from
<code class="filename">
mysqld-auto.cnf
</code>
, but produce a
warning rather than an error if the variable is not
present in the file, add an
<code class="literal">
IF EXISTS
</code>
clause to the previous syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa26207729"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">PERSIST</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> <em class="replaceable">system_var_name</em><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
For more information about
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET
PERSIST
</code>
</a>
, see
<a class="xref" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
Section 15.7.8.7, “RESET PERSIST Statement”
</a>
.
</p>
<p>
Using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
to
persist a global system variable to a value of
<code class="literal">
DEFAULT
</code>
or to its literal default value
assigns the variable its default value and adds a setting for
the variable to
<code class="filename">
mysqld-auto.cnf
</code>
. To
remove the variable from the file, use
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
.
</p>
<p>
Some system variables cannot be persisted. See
<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>
.
</p>
<p>
A system variable implemented by a plugin can be persisted if
the plugin is installed when the
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement is executed. Assignment of the persisted plugin
variable takes effect for subsequent server restarts if the
plugin is still installed. If the plugin is no longer
installed, the plugin variable does not exist when the server
reads the
<code class="filename">
mysqld-auto.cnf
</code>
file. In this
case, the server writes a warning to the error log and
continues:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa92937398"><div class="copy-help left">Press ⌘+C to 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">currently unknown variable '<em class="replaceable">var_name</em>'
was read from the persisted config file</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="persisted-system-variables-information">
</a>
Obtaining Information About Persisted System Variables
</h5>
</div>
</div>
</div>
<p>
The Performance Schema
<a class="link" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
<code class="literal">
persisted_variables
</code>
</a>
table
provides an SQL interface to the
<code class="filename">
mysqld-auto.cnf
</code>
file, enabling its
contents to be inspected at runtime using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements. See
<a class="xref" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
Section 29.12.14.1, “Performance Schema persisted_variables Table”
</a>
.
</p>
<p>
The Performance Schema
<a class="link" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
<code class="literal">
variables_info
</code>
</a>
table contains
information showing when and by which user each system
variable was most recently set. See
<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>
.
</p>
<p>
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
affects the
contents of the
<a class="link" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
<code class="literal">
persisted_variables
</code>
</a>
table because
the table contents correspond to the contents of the
<code class="filename">
mysqld-auto.cnf
</code>
file. On the other hand,
because
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
does not
change variable values, it has no effect on the contents of
the
<a class="link" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
<code class="literal">
variables_info
</code>
</a>
table until
the server is restarted.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="persisted-system-variables-file-handling">
</a>
Format and Server Handling of the mysqld-auto.cnf File
</h5>
</div>
</div>
</div>
<p>
The
<code class="filename">
mysqld-auto.cnf
</code>
file uses a
<code class="literal">
JSON
</code>
format like this (reformatted slightly
for readability):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-json"><div class="docs-select-all right" id="sa62690295"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-json"><span class="token punctuation">{</span>
<span class="token property">"Version"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"mysql_server"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"max_connections"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Value"</span><span class="token operator">:</span> <span class="token string">"152"</span><span class="token punctuation">,</span>
<span class="token property">"Metadata"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Timestamp"</span><span class="token operator">:</span> <span class="token number">1519921341372531</span><span class="token punctuation">,</span>
<span class="token property">"User"</span><span class="token operator">:</span> <span class="token string">"root"</span><span class="token punctuation">,</span>
<span class="token property">"Host"</span><span class="token operator">:</span> <span class="token string">"localhost"</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"transaction_isolation"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Value"</span><span class="token operator">:</span> <span class="token string">"READ-COMMITTED"</span><span class="token punctuation">,</span>
<span class="token property">"Metadata"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Timestamp"</span><span class="token operator">:</span> <span class="token number">1519921553880520</span><span class="token punctuation">,</span>
<span class="token property">"User"</span><span class="token operator">:</span> <span class="token string">"root"</span><span class="token punctuation">,</span>
<span class="token property">"Host"</span><span class="token operator">:</span> <span class="token string">"localhost"</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"mysql_server_static_options"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"innodb_api_enable_mdl"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Value"</span><span class="token operator">:</span> <span class="token string">"0"</span><span class="token punctuation">,</span>
<span class="token property">"Metadata"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Timestamp"</span><span class="token operator">:</span> <span class="token number">1519922873467872</span><span class="token punctuation">,</span>
<span class="token property">"User"</span><span class="token operator">:</span> <span class="token string">"root"</span><span class="token punctuation">,</span>
<span class="token property">"Host"</span><span class="token operator">:</span> <span class="token string">"localhost"</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"log_replica_updates"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Value"</span><span class="token operator">:</span> <span class="token string">"1"</span><span class="token punctuation">,</span>
<span class="token property">"Metadata"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Timestamp"</span><span class="token operator">:</span> <span class="token number">1519925628441588</span><span class="token punctuation">,</span>
<span class="token property">"User"</span><span class="token operator">:</span> <span class="token string">"root"</span><span class="token punctuation">,</span>
<span class="token property">"Host"</span><span class="token operator">:</span> <span class="token string">"localhost"</span>
<span class="token punctuation">}</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>
At startup, the server processes the
<code class="filename">
mysqld-auto.cnf
</code>
file after all other
option files (see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
). The server
handles the file contents as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the
<a class="link" href="server-system-variables.html#sysvar_persisted_globals_load">
<code class="literal">
persisted_globals_load
</code>
</a>
system variable is disabled, the server ignores the
<code class="filename">
mysqld-auto.cnf
</code>
file.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
"mysql_server_static_options"
</code>
section contains read-only variables persisted using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
PERSIST_ONLY
</code>
</a>
. The section may also (despite its
name) contain certain dynamic variables that are not read
only. All variables present inside this section are
appended to the command line and processed with other
command-line options.
</p>
</li>
<li class="listitem">
<p>
All remaining persisted variables are set by executing the
equivalent of 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 later, just before the server
starts listening for client connections. These settings
therefore do not take effect until late in the startup
process, which might be unsuitable for certain system
variables. It may be preferable to set such variables in
<code class="filename">
my.cnf
</code>
rather than in
<code class="filename">
mysqld-auto.cnf
</code>
.
</p>
</li>
</ul>
</div>
<p>
Management of the
<code class="filename">
mysqld-auto.cnf
</code>
file
should be left to the server. Manipulation of the file should
be performed only using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
and
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
</code>
</a>
statements,
not manually:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Removal of the file results in a loss of all persisted
settings at the next server startup. (This is permissible
if your intent is to reconfigure the server without these
settings.) To remove all settings in the file without
removing the file itself, use this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10385518"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RESET</span> <span class="token keyword">PERSIST</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Manual changes to the file may result in a parse error at
server startup. In this case, the server reports an error
and exits. If this issue occurs, start the server with the
<a class="link" href="server-system-variables.html#sysvar_persisted_globals_load">
<code class="literal">
persisted_globals_load
</code>
</a>
system variable disabled or with the
<a class="link" href="server-options.html#option_mysqld_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
option.
Alternatively, remove the
<code class="filename">
mysqld-auto.cnf
</code>
file. However, as
noted previously, removing this file results in a loss of
all persisted settings.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="persisted-system-variables-sensitive">
</a>
Persisting Sensitive System Variables
</h5>
</div>
</div>
</div>
<p>
MySQL 8.4 has the capability to store persisted
system variable values containing sensitive data such as
private keys or passwords securely, and to restrict viewing of
the values. No MySQL Server system variables are currently
marked as sensitive, but this capability allows system
variables containing sensitive data to be persisted securely
in the future. A
<code class="filename">
mysqld-auto.cnf
</code>
option
file created by MySQL 8.4 cannot be read by older
releases of MySQL Server.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A keyring component must be enabled on the MySQL Server
instance to support secure storage for persisted system
variable values, rather than a keyring plugin, which do not
support the function. See
<a class="xref" href="keyring.html" title="8.4.4 The MySQL Keyring">
Section 8.4.4, “The MySQL Keyring”
</a>
.
</p>
</div>
<p>
In the
<code class="filename">
mysqld-auto.cnf
</code>
option file, the
names and values of sensitive system variables are stored in
an encrypted format, along with a generated file key to
decrypt them. The generated file key is in turn encrypted
using a master key
(
<code class="literal">
persisted_variables_key
</code>
) that is stored in
a keyring. When the server starts up, the persisted sensitive
system variables are decrypted and used. By default, if
encrypted values are present in the option file but cannot be
successfully decrypted at startup, their default settings are
used. The optional most secure setting makes the server halt
startup if the encrypted values cannot be decrypted.
</p>
<p>
The system variable
<a class="link" href="server-system-variables.html#sysvar_persist_sensitive_variables_in_plaintext">
<code class="literal">
persist_sensitive_variables_in_plaintext
</code>
</a>
controls whether the server is permitted to store the values
of sensitive system variables in an unencrypted format, if
keyring component support is not available at the time when
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
PERSIST
</code>
</a>
is used to set the value. It also controls
whether or not the server can start if the encrypted values
cannot be decrypted.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The default setting,
<code class="literal">
ON
</code>
, encrypts the
values if keyring component support is available, and
persists them unencrypted (with a warning) if it is not.
The next time any persisted system variable is set, if
keyring support is available at that time, the server
encrypts the values of any unencrypted sensitive system
variables. The
<code class="literal">
ON
</code>
setting also allows
the server to start if encrypted system variable values
cannot be decrypted, in which case a warning is issued and
the default values for the system variables are used. In
that situation, their values cannot be changed until they
can be decrypted.
</p>
</li>
<li class="listitem">
<p>
The most secure setting,
<code class="literal">
OFF
</code>
, means
sensitive system variable values cannot be persisted if
keyring component support is unavailable. The
<code class="literal">
OFF
</code>
setting also means the server does
not start if encrypted system variable values cannot be
decrypted.
</p>
</li>
</ul>
</div>
<p>
The privilege
<a class="link" href="privileges-provided.html#priv_sensitive-variables-observer">
<code class="literal">
SENSITIVE_VARIABLES_OBSERVER
</code>
</a>
allows a holder to view the values of sensitive system
variables in the Performance Schema tables
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
,
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
,
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
, and
<a class="link" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
<code class="literal">
persisted_variables
</code>
</a>
,
to issue
<code class="literal">
SELECT
</code>
statements to return their
values, and to track changes to them in session trackers for
connections. Users without this privilege cannot view or track
those system variable values.
</p>
<p>
If a
<code class="literal">
SET
</code>
statement is issued for a
sensitive system variable, the query is rewritten to replace
the value with
<span class="quote">
“
<span class="quote">
<code class="literal">
<redacted>
</code>
</span>
”
</span>
before it is logged to the general log and audit log. This
takes place even if secure storage through a keyring component
is not available on the server instance.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisamchk-repair-options.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="myisamchk-repair-options">
</a>
6.6.4.3 myisamchk Repair Options
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045307114032">
</a>
<a class="indexterm" name="idm46045307112544">
</a>
<p>
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
supports the following options for
table repair operations (operations performed when an option
such as
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
or
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
<code class="option">
--safe-recover
</code>
</a>
is given):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_myisamchk_backup">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_backup">
<code class="option">
--backup
</code>
</a>
,
<code class="option">
-B
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backup">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backup
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307099168">
</a>
<a class="indexterm" name="idm46045307097680">
</a>
<p>
Make a backup of the
<code class="filename">
.MYD
</code>
file as
<code class="filename">
<em class="replaceable">
<code>
file_name
</code>
</em>
-
<em class="replaceable">
<code>
time
</code>
</em>
.BAK
</code>
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_character-sets-dir">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_character-sets-dir">
<code class="option">
--character-sets-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307081136">
</a>
<a class="indexterm" name="idm46045307079632">
</a>
<p>
The directory where character sets are installed. 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>
<a name="option_myisamchk_correct-checksum">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_correct-checksum">
<code class="option">
--correct-checksum
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for correct-checksum">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--correct-checksum
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307069328">
</a>
<a class="indexterm" name="idm46045307067840">
</a>
<p>
Correct the checksum information for the table.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_data-file-length">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_data-file-length">
<code class="option">
--data-file-length=
<em class="replaceable">
<code>
len
</code>
</em>
</code>
</a>
,
<code class="option">
-D
<em class="replaceable">
<code>
len
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for data-file-length">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--data-file-length=len
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307055216">
</a>
<a class="indexterm" name="idm46045307053728">
</a>
<p>
The maximum length of the data file (when re-creating data
file when it is
<span class="quote">
“
<span class="quote">
full
</span>
”
</span>
).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_extend-check">
<code class="option">
--extend-check
</code>
</a>
,
<code class="option">
-e
</code>
<a class="indexterm" name="idm46045307049232">
</a>
<a class="indexterm" name="idm46045307047744">
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for extend-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--extend-check
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307040656">
</a>
<a class="indexterm" name="idm46045307039168">
</a>
<p>
Do a repair that tries to recover every possible row from
the data file. Normally, this also finds a lot of garbage
rows. Do not use this option unless you are desperate.
</p>
<p>
See also the description of this option under table checking
options.
</p>
<p>
For a description of the output format, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_force">
<code class="option">
--force
</code>
</a>
,
<code class="option">
-f
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for force">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--force
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307027792">
</a>
<a class="indexterm" name="idm46045307026304">
</a>
<p>
Overwrite old intermediate files (files with names like
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.TMD
</code>
)
instead of aborting.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_keys-used">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_keys-used">
<code class="option">
--keys-used=
<em class="replaceable">
<code>
val
</code>
</em>
</code>
</a>
,
<code class="option">
-k
<em class="replaceable">
<code>
val
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for keys-used">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--keys-used=val
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045307012672">
</a>
<a class="indexterm" name="idm46045307011184">
</a>
<p>
For
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, the option value is a bit
value that indicates which indexes to update. Each binary
bit of the option value corresponds to a table index, where
the first index is bit 0. An option value of 0 disables
updates to all indexes, which can be used to get faster
inserts. Deactivated indexes can be reactivated by using
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -r
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_max-record-length">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_max-record-length">
<code class="option">
--max-record-length=
<em class="replaceable">
<code>
len
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for max-record-length">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--max-record-length=len
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306996496">
</a>
<a class="indexterm" name="idm46045306994992">
</a>
<p>
Skip rows larger than the given length if
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
cannot allocate memory to hold
them.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_quick">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_quick">
<code class="option">
--quick
</code>
</a>
,
<code class="option">
-q
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for quick">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--quick
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306983696">
</a>
<a class="indexterm" name="idm46045306982208">
</a>
<p>
Achieve a faster repair by modifying only the index file,
not the data file. You can specify this option twice to
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 modify the original
data file in case of duplicate keys.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_recover">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
,
<code class="option">
-r
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for recover">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--recover
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306970704">
</a>
<a class="indexterm" name="idm46045306969216">
</a>
<p>
Do a repair that can fix almost any problem except unique
keys that are not unique (which is an extremely unlikely
error with
<code class="literal">
MyISAM
</code>
tables). If you want to
recover a table, this is the option to try first. You should
try
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
<code class="option">
--safe-recover
</code>
</a>
only if
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
reports that the table cannot
be recovered using
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
. (In the
unlikely case that
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
fails, the data
file remains intact.)
</p>
<p>
If you have lots of memory, you should increase the value of
<code class="literal">
myisam_sort_buffer_size
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_safe-recover">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
<code class="option">
--safe-recover
</code>
</a>
,
<code class="option">
-o
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for safe-recover">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--safe-recover
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306952784">
</a>
<a class="indexterm" name="idm46045306951296">
</a>
<p>
Do a repair using an old recovery method that reads through
all rows in order and updates all index trees based on the
rows found. This is an order of magnitude slower than
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
, but can handle
a couple of very unlikely cases that
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
cannot. This
recovery method also uses much less disk space than
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
. Normally, you
should repair first using
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
, and then with
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
<code class="option">
--safe-recover
</code>
</a>
only if
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
<code class="option">
--recover
</code>
</a>
fails.
</p>
<p>
If you have lots of memory, you should increase the value of
<code class="literal">
key_buffer_size
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_set-collation">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_set-collation">
<code class="option">
--set-collation=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for set-collation">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--set-collation=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306931840">
</a>
<a class="indexterm" name="idm46045306930352">
</a>
<p>
Specify the collation to use for sorting table indexes. The
character set name is implied by the first part of the
collation name.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_sort-recover">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_sort-recover">
<code class="option">
--sort-recover
</code>
</a>
,
<code class="option">
-n
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for sort-recover">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--sort-recover
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306920224">
</a>
<a class="indexterm" name="idm46045306918736">
</a>
<p>
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 use sorting to resolve
the keys even if the temporary files would be very large.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_tmpdir">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_tmpdir">
<code class="option">
--tmpdir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
,
<code class="option">
-t
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tmpdir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tmpdir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306904896">
</a>
<a class="indexterm" name="idm46045306903408">
</a>
<p>
The path of the directory to be used for storing temporary
files. If this is not set,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
uses
the value of the
<code class="literal">
TMPDIR
</code>
environment
variable.
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_tmpdir">
<code class="option">
--tmpdir
</code>
</a>
can be
set to a list of directory paths that are used successively
in round-robin fashion for creating temporary files. The
separator character between directory names is the colon
(
<code class="literal">
:
</code>
) on Unix and the semicolon
(
<code class="literal">
;
</code>
) on Windows.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisamchk_unpack">
</a>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_unpack">
<code class="option">
--unpack
</code>
</a>
,
<code class="option">
-u
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for unpack">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--unpack
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306888784">
</a>
<a class="indexterm" name="idm46045306887296">
</a>
<p>
Unpack a table that was packed with
<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>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-tables-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-tables-table">
</a>
28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076529152">
</a>
<p>
The
<a class="link" href="information-schema-innodb-tables-table.html" title="28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table">
<code class="literal">
INNODB_TABLES
</code>
</a>
table provides
metadata about
<code class="literal">
InnoDB
</code>
tables.
</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>
<p>
The
<a class="link" href="information-schema-innodb-tables-table.html" title="28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table">
<code class="literal">
INNODB_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_ID
</code>
</p>
<p>
An identifier for the
<code class="literal">
InnoDB
</code>
table. This
value is unique across all databases in the instance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NAME
</code>
</p>
<p>
The name of the table, preceded by the schema (database) name
where appropriate (for example,
<code class="literal">
test/t1
</code>
).
Names of databases and user tables are in the same case as
they were originally defined, possibly influenced by the
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FLAG
</code>
</p>
<p>
A numeric value that represents bit-level information about
table format and storage characteristics.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
N_COLS
</code>
</p>
<p>
The number of columns in the table. The number reported
includes three hidden columns that are created by
<code class="literal">
InnoDB
</code>
(
<code class="literal">
DB_ROW_ID
</code>
,
<code class="literal">
DB_TRX_ID
</code>
, and
<code class="literal">
DB_ROLL_PTR
</code>
). The number reported also
includes
<a class="link" href="glossary.html#glos_virtual_generated_column" title="virtual generated column">
virtual
generated columns
</a>
, if present.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SPACE
</code>
</p>
<p>
An identifier for the tablespace where the table resides. 0
means the
<code class="literal">
InnoDB
</code>
<a class="link" href="glossary.html#glos_system_tablespace" title="system tablespace">
system
tablespace
</a>
. Any other number represents either a
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
</a>
tablespace or a general tablespace. This identifier stays the
same after a
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
statement. For file-per-table tablespaces, this identifier is
unique for tables across all databases in the instance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROW_FORMAT
</code>
</p>
<p>
The table's row format (
<code class="literal">
Compact
</code>
,
<code class="literal">
Redundant
</code>
,
<code class="literal">
Dynamic
</code>
, or
<code class="literal">
Compressed
</code>
).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ZIP_PAGE_SIZE
</code>
</p>
<p>
The zip page size. Applies only to tables with a row format of
<code class="literal">
Compressed
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SPACE_TYPE
</code>
</p>
<p>
The type of tablespace to which the table belongs. Possible
values include
<code class="literal">
System
</code>
for the system
tablespace,
<code class="literal">
General
</code>
for general
tablespaces, and
<code class="literal">
Single
</code>
for file-per-table
tablespaces. Tables assigned to the system tablespace using
<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>
<code class="literal">
TABLESPACE=innodb_system
</code>
have a
<code class="literal">
SPACE_TYPE
</code>
of
<code class="literal">
General
</code>
.
For more information, see
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE
TABLESPACE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INSTANT_COLS
</code>
</p>
<p>
The number of columns that existed before the first instant
column was added using
<code class="literal">
ALTER TABLE
... ADD COLUMN
</code>
with
<code class="literal">
ALGORITHM=INSTANT
</code>
. This column is no longer
used.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TOTAL_ROW_VERSIONS
</code>
</p>
<p>
The number of row versions for the table. The initial value is
0. The value is incremented by
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ALGORITHM=INSTANT
</code>
</a>
operations that add or remove
columns. When a table with instantly added or dropped columns
is rebuilt due to a table-rebuilding
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
or
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operation, the
value is reset to 0. For more information, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-column-operations" title="Column Operations">
Column Operations
</a>
.
</p>
<p>
The maximum
<code class="literal">
TOTAL_ROW_VERSIONS
</code>
value is 64.
This maximum value changes from 64 to 255 as of MySQL 9.1.0.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045076472608">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43452721"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_TABLES <span class="token keyword">WHERE</span> TABLE_ID <span class="token operator">=</span> <span class="token number">214</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>
TABLE_ID<span class="token punctuation">:</span> 1064
NAME<span class="token punctuation">:</span> test/t1
FLAG<span class="token punctuation">:</span> 33
N_COLS<span class="token punctuation">:</span> 6
SPACE<span class="token punctuation">:</span> 3
ROW_FORMAT<span class="token punctuation">:</span> Dynamic
ZIP_PAGE_SIZE<span class="token punctuation">:</span> 0
SPACE_TYPE<span class="token punctuation">:</span> Single
INSTANT_COLS<span class="token punctuation">:</span> 0
TOTAL_ROW_VERSIONS<span class="token punctuation">:</span> 3</span></code></pre>
</div>
<h4>
<a name="idm46045076469936">
</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/gis-class-multipoint.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gis-class-multipoint">
</a>
13.4.2.9 MultiPoint Class
</h4>
</div>
</div>
</div>
<p>
A
<code class="literal">
MultiPoint
</code>
is a geometry collection
composed of
<code class="literal">
Point
</code>
elements. The points are
not connected or ordered in any way.
</p>
<p>
<span class="bold">
<strong>
<code class="literal">
MultiPoint
</code>
Examples
</strong>
</span>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On a world map, a
<code class="literal">
MultiPoint
</code>
could
represent a chain of small islands.
</p>
</li>
<li class="listitem">
<p>
On a city map, a
<code class="literal">
MultiPoint
</code>
could
represent the outlets for a ticket office.
</p>
</li>
</ul>
</div>
<p>
<span class="bold">
<strong>
<code class="literal">
MultiPoint
</code>
Properties
</strong>
</span>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
MultiPoint
</code>
is a zero-dimensional
geometry.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPoint
</code>
is simple if no two of its
<code class="literal">
Point
</code>
values are equal (have identical
coordinate values).
</p>
</li>
<li class="listitem">
<p>
The boundary of a
<code class="literal">
MultiPoint
</code>
is the
empty set.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-table-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-table-reference">
</a>
29.12.1 Performance Schema Table Reference
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045074351264">
</a>
<a class="indexterm" name="idm46045074349776">
</a>
<p>
The following table summarizes all available Performance Schema
tables. For greater detail, see the individual table
descriptions.
</p>
<div class="table">
<a name="performance-schema-tables-table">
</a>
<p class="title">
<b>
Table 29.1 Performance Schema Tables
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists all Performance Schema tables.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Table Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="performance-schema-accounts-table.html" title="29.12.8.1 The accounts Table">
<code class="literal">
accounts
</code>
</a>
</td>
<td>
Connection statistics per client account
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-binary-log-transaction-compression-stats-table.html" title="29.12.11.1 The binary_log_transaction_compression_stats Table">
<code class="literal">
binary_log_transaction_compression_stats
</code>
</a>
</td>
<td>
Binary log transaction compression
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-clone-progress-table.html" title="29.12.19.2 The clone_progress Table">
<code class="literal">
clone_progress
</code>
</a>
</td>
<td>
Clone operation progress
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Clone operation status
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-component-scheduler-tasks-table.html" title="29.12.22.1 The component_scheduler_tasks Table">
<code class="literal">
component_scheduler_tasks
</code>
</a>
</td>
<td>
Status of scheduled tasks
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-cond-instances-table.html" title="29.12.3.1 The cond_instances Table">
<code class="literal">
cond_instances
</code>
</a>
</td>
<td>
Synchronization object instances
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
</td>
<td>
Data lock wait relationships
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
</td>
<td>
Data locks held and requested
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
</td>
<td>
Server error log recent entries
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
<code class="literal">
events_errors_summary_by_account_by_error
</code>
</a>
</td>
<td>
Errors per account and error code
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
<code class="literal">
events_errors_summary_by_host_by_error
</code>
</a>
</td>
<td>
Errors per host and error code
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
<code class="literal">
events_errors_summary_by_thread_by_error
</code>
</a>
</td>
<td>
Errors per thread and error code
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
<code class="literal">
events_errors_summary_by_user_by_error
</code>
</a>
</td>
<td>
Errors per user and error code
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
<code class="literal">
events_errors_summary_global_by_error
</code>
</a>
</td>
<td>
Errors per error code
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Current stage events
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-stages-history-table.html" title="29.12.5.2 The events_stages_history Table">
<code class="literal">
events_stages_history
</code>
</a>
</td>
<td>
Most recent stage events per thread
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-stages-history-long-table.html" title="29.12.5.3 The events_stages_history_long Table">
<code class="literal">
events_stages_history_long
</code>
</a>
</td>
<td>
Most recent stage events overall
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Stage events per account and event name
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Stage events per host name and event name
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Stage waits per thread and event name
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Stage events per user name and event name
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Stage waits per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
<code class="literal">
events_statements_current
</code>
</a>
</td>
<td>
Current statement events
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-histogram-summary-tables.html" title="29.12.20.4 Statement Histogram Summary Tables">
<code class="literal">
events_statements_histogram_by_digest
</code>
</a>
</td>
<td>
Statement histograms per schema and digest value
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-histogram-summary-tables.html" title="29.12.20.4 Statement Histogram Summary Tables">
<code class="literal">
events_statements_histogram_global
</code>
</a>
</td>
<td>
Statement histogram summarized globally
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
<code class="literal">
events_statements_history
</code>
</a>
</td>
<td>
Most recent statement events per thread
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-statements-history-long-table.html" title="29.12.6.3 The events_statements_history_long Table">
<code class="literal">
events_statements_history_long
</code>
</a>
</td>
<td>
Most recent statement events overall
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_account_by_event_name
</code>
</a>
</td>
<td>
Statement events per account and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
</td>
<td>
Statement events per schema and digest value
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_host_by_event_name
</code>
</a>
</td>
<td>
Statement events per host name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_program
</code>
</a>
</td>
<td>
Statement events per stored program
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_thread_by_event_name
</code>
</a>
</td>
<td>
Statement events per thread and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_user_by_event_name
</code>
</a>
</td>
<td>
Statement events per user name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_global_by_event_name
</code>
</a>
</td>
<td>
Statement events per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-transactions-current-table.html" title="29.12.7.1 The events_transactions_current Table">
<code class="literal">
events_transactions_current
</code>
</a>
</td>
<td>
Current transaction events
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-transactions-history-table.html" title="29.12.7.2 The events_transactions_history Table">
<code class="literal">
events_transactions_history
</code>
</a>
</td>
<td>
Most recent transaction events per thread
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-transactions-history-long-table.html" title="29.12.7.3 The events_transactions_history_long Table">
<code class="literal">
events_transactions_history_long
</code>
</a>
</td>
<td>
Most recent transaction events overall
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_account_by_event_name
</code>
</a>
</td>
<td>
Transaction events per account and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_host_by_event_name
</code>
</a>
</td>
<td>
Transaction events per host name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_thread_by_event_name
</code>
</a>
</td>
<td>
Transaction events per thread and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_user_by_event_name
</code>
</a>
</td>
<td>
Transaction events per user name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_global_by_event_name
</code>
</a>
</td>
<td>
Transaction events per event name
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Current wait events
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-waits-history-table.html" title="29.12.4.2 The events_waits_history Table">
<code class="literal">
events_waits_history
</code>
</a>
</td>
<td>
Most recent wait events per thread
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-events-waits-history-long-table.html" title="29.12.4.3 The events_waits_history_long Table">
<code class="literal">
events_waits_history_long
</code>
</a>
</td>
<td>
Most recent wait events overall
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_by_account_by_event_name
</code>
</a>
</td>
<td>
Wait events per account and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_by_host_by_event_name
</code>
</a>
</td>
<td>
Wait events per host name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_by_instance
</code>
</a>
</td>
<td>
Wait events per instance
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_by_thread_by_event_name
</code>
</a>
</td>
<td>
Wait events per thread and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_by_user_by_event_name
</code>
</a>
</td>
<td>
Wait events per user name and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
<code class="literal">
events_waits_summary_global_by_event_name
</code>
</a>
</td>
<td>
Wait events per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-file-instances-table.html" title="29.12.3.2 The file_instances Table">
<code class="literal">
file_instances
</code>
</a>
</td>
<td>
File instances
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-file-summary-tables.html" title="29.12.20.7 File I/O Summary Tables">
<code class="literal">
file_summary_by_event_name
</code>
</a>
</td>
<td>
File events per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-file-summary-tables.html" title="29.12.20.7 File I/O Summary Tables">
<code class="literal">
file_summary_by_instance
</code>
</a>
</td>
<td>
File events per file instance
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Firewall in-memory data for group profile allowlists
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Firewall in-memory data for group profiles
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Firewall in-memory data for group profile members
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
global_status
</code>
</a>
</td>
<td>
Global status variables
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
</td>
<td>
Global system variables
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
</td>
<td>
Information from internal host cache
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-hosts-table.html" title="29.12.8.2 The hosts Table">
<code class="literal">
hosts
</code>
</a>
</td>
<td>
Connection statistics per client host name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-keyring-component-status-table.html" title="29.12.18.1 The keyring_component_status Table">
<code class="literal">
keyring_component_status
</code>
</a>
</td>
<td>
Status information for installed keyring component
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-keyring-keys-table.html" title="29.12.18.2 The keyring_keys table">
<code class="literal">
keyring_keys
</code>
</a>
</td>
<td>
Metadata for keyring keys
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-log-status-table.html" title="29.12.22.5 The log_status Table">
<code class="literal">
log_status
</code>
</a>
</td>
<td>
Information about server logs for backup purposes
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_by_account_by_event_name
</code>
</a>
</td>
<td>
Memory operations per account and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_by_host_by_event_name
</code>
</a>
</td>
<td>
Memory operations per host and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_by_thread_by_event_name
</code>
</a>
</td>
<td>
Memory operations per thread and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_by_user_by_event_name
</code>
</a>
</td>
<td>
Memory operations per user and event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_global_by_event_name
</code>
</a>
</td>
<td>
Memory operations globally per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-metadata-locks-table.html" title="29.12.13.3 The metadata_locks Table">
<code class="literal">
metadata_locks
</code>
</a>
</td>
<td>
Metadata locks and lock requests
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-mutex-instances-table.html" title="29.12.3.3 The mutex_instances Table">
<code class="literal">
mutex_instances
</code>
</a>
</td>
<td>
Mutex synchronization object instances
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-ndb-sync-excluded-objects-table.html" title="29.12.12.2 The ndb_sync_excluded_objects Table">
<code class="literal">
ndb_sync_excluded_objects
</code>
</a>
</td>
<td>
NDB objects which cannot be synchronized
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-ndb-sync-pending-objects-table.html" title="29.12.12.1 The ndb_sync_pending_objects Table">
<code class="literal">
ndb_sync_pending_objects
</code>
</a>
</td>
<td>
NDB objects waiting for synchronization
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-objects-summary-global-by-type-table.html" title="29.12.20.6 Object Wait Summary Table">
<code class="literal">
objects_summary_global_by_type
</code>
</a>
</td>
<td>
Object summaries
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
</td>
<td>
Which event timers are available
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
persisted_variables
</code>
</a>
</td>
<td>
Contents of mysqld-auto.cnf file
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
</td>
<td>
Prepared statement instances and statistics
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
processlist
</code>
</a>
</td>
<td>
Process list information
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-configuration-table.html" title="29.12.11.2 The replication_applier_configuration Table">
<code class="literal">
replication_applier_configuration
</code>
</a>
</td>
<td>
Configuration parameters for replication applier on replica
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-filters-table.html" title="29.12.11.3 The replication_applier_filters Table">
<code class="literal">
replication_applier_filters
</code>
</a>
</td>
<td>
Channel-specific replication filters on current replica
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-global-filters-table.html" title="29.12.11.4 The replication_applier_global_filters Table">
<code class="literal">
replication_applier_global_filters
</code>
</a>
</td>
<td>
Global replication filters on current replica
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-status-table.html" title="29.12.11.5 The replication_applier_status Table">
<code class="literal">
replication_applier_status
</code>
</a>
</td>
<td>
Current status of replication applier on replica
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-status-by-coordinator-table.html" title="29.12.11.6 The replication_applier_status_by_coordinator Table">
<code class="literal">
replication_applier_status_by_coordinator
</code>
</a>
</td>
<td>
SQL or coordinator thread applier status
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
</td>
<td>
Worker thread applier status
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Source lists for asynchronous connection failover mechanism
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Managed source lists for asynchronous connection failover mechanism
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
<code class="literal">
replication_connection_configuration
</code>
</a>
</td>
<td>
Configuration parameters for connecting to source
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
</td>
<td>
Current status of connection to source
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-group-communication-information-table.html" title="29.12.11.10 The replication_group_communication_information Table">
<code class="literal">
replication_group_communication_information
</code>
</a>
</td>
<td>
Replication group configuration options
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-replication-group-member-stats-table.html" title="29.12.11.15 The replication_group_member_stats Table">
<code class="literal">
replication_group_member_stats
</code>
</a>
</td>
<td>
Replication group member statistics
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Replication group member network and status
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-rwlock-instances-table.html" title="29.12.3.4 The rwlock_instances Table">
<code class="literal">
rwlock_instances
</code>
</a>
</td>
<td>
Lock synchronization object instances
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-session-account-connect-attrs-table.html" title="29.12.9.1 The session_account_connect_attrs Table">
<code class="literal">
session_account_connect_attrs
</code>
</a>
</td>
<td>
Connection attributes per for current session
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-session-connect-attrs-table.html" title="29.12.9.2 The session_connect_attrs Table">
<code class="literal">
session_connect_attrs
</code>
</a>
</td>
<td>
Connection attributes for all sessions
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
session_status
</code>
</a>
</td>
<td>
Status variables for current session
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
</td>
<td>
System variables for current session
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
</td>
<td>
How to initialize monitoring for new foreground threads
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-setup-consumers-table.html" title="29.12.2.2 The setup_consumers Table">
<code class="literal">
setup_consumers
</code>
</a>
</td>
<td>
Consumers for which event information can be stored
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Classes of instrumented objects for which events can be collected
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
</td>
<td>
Which objects should be monitored
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-setup-threads-table.html" title="29.12.2.5 The setup_threads Table">
<code class="literal">
setup_threads
</code>
</a>
</td>
<td>
Instrumented thread names and attributes
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-socket-instances-table.html" title="29.12.3.5 The socket_instances Table">
<code class="literal">
socket_instances
</code>
</a>
</td>
<td>
Active connection instances
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-socket-summary-tables.html" title="29.12.20.9 Socket Summary Tables">
<code class="literal">
socket_summary_by_event_name
</code>
</a>
</td>
<td>
Socket waits and I/O per event name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-socket-summary-tables.html" title="29.12.20.9 Socket Summary Tables">
<code class="literal">
socket_summary_by_instance
</code>
</a>
</td>
<td>
Socket waits and I/O per instance
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_account
</code>
</a>
</td>
<td>
Session status variables per account
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_host
</code>
</a>
</td>
<td>
Session status variables per host name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
status_by_thread
</code>
</a>
</td>
<td>
Session status variables per session
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_user
</code>
</a>
</td>
<td>
Session status variables per user name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
</td>
<td>
Table locks and lock requests
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
</td>
<td>
Table I/O waits per index
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
</td>
<td>
Table I/O waits per table
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
</td>
<td>
Table lock waits per table
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
</td>
<td>
Information about server threads
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
<code class="literal">
tls_channel_status
</code>
</a>
</td>
<td>
TLS status for each connection interface
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-tp-thread-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
<code class="literal">
tp_thread_group_state
</code>
</a>
</td>
<td>
Thread pool thread group states
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-tp-thread-group-stats-table.html" title="29.12.16.3 The tp_thread_group_stats Table">
<code class="literal">
tp_thread_group_stats
</code>
</a>
</td>
<td>
Thread pool thread group statistics
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
<code class="literal">
tp_thread_state
</code>
</a>
</td>
<td>
Thread pool thread information
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-user-defined-functions-table.html" title="29.12.22.10 The user_defined_functions Table">
<code class="literal">
user_defined_functions
</code>
</a>
</td>
<td>
Registered loadable functions
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-user-variable-tables.html" title="29.12.10 Performance Schema User-Defined Variable Tables">
<code class="literal">
user_variables_by_thread
</code>
</a>
</td>
<td>
User-defined variables per thread
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-users-table.html" title="29.12.8.3 The users Table">
<code class="literal">
users
</code>
</a>
</td>
<td>
Connection statistics per client user name
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
</td>
<td>
Session system variables per session
</td>
</tr>
<tr>
<td>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_info
</code>
</a>
</td>
<td>
How system variables were most recently set
</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: 429.531px;">
Table Name
</th>
<th style="width: 308.469px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
Subsets and Splits