_embedded program to run embedded test cases
add an example, a script, a trick and tips
no example yet ...
... Feel free to add your own example above to help other Linux-lovers !
mysqltest program runs a test case against a MySQL
server and optionally compares the output with a result
file. This program reads input written in a special test
language. Typically, you invoke mysqltest using
mysql-test-run.pl rather than invoking it
is similar but is built with support for the libmysqld
• Can send
SQL statements to MySQL servers for execution
execute external shell commands
• Can test
whether the result from an SQL statement or shell command is
connect to one or more standalone mysqld servers and
switch between connections
connect to an embedded server (libmysqld), if MySQL is
compiled with support for libmysqld. (In this case, the
executable is named mysqltest_embedded rather than
mysqltest reads the test case on the standard input.
To run mysqltest this way, you normally invoke it
mysqltest [options] [db_name]
You can also
name the test case file with a
The exit value
from mysqltest is 0 for success, 1 for failure, and
62 if it skips the test case (for example, if after checking
some preconditions it decides not to run the test).
supports the following options:
Display a help
message and exit.
directory for tests.
where character sets are installed.
information sent between the client and the server if both
Use cursors for
database to use.
debugging log if MySQL is built with debugging support. The
default debug_options value is
debugging information when the program exits.
information and memory and CPU usage statistics when the
Connect to the
MySQL server on the given host.
contents of the given file before processing the contents of
the test file. The included file should have the same format
as other mysqltest test files. This option has the
same effect as putting a --source
file_name command as the first line of the test
to use for log files.
Write the line
number and elapsed time to test_file.progress.
number of connection attempts when connecting to server.
number of simultaneous server connections per client (that
is, per test). If not set, the maximum is 128. Minimum
allowed limit is 8, maximum is 5120.
This option is
available from MySQL 5.1.45.
Do not read
default options from any option files. If used, this must be
the first option.
in which to look for plugins. It may be necessary to specify
this option if the default_auth argument is used for
the connect() command to specify an authentication plugin
but mysqltest does not find it. This option was added
in MySQL 5.5.7.
The password to
use when connecting to the server. If you use the short
option form (-p), you cannot have a
space between the option and the password. If you omit the
password value following the
--password or -p option on
the command line, you are prompted for one.
The TCP/IP port
number to use for the connection.
protocol for communication with the server. SOCKET is
--protocol option is available from MySQL
5.1.51. It is ignored if running with the embedded
prepared-statement protocol for communication.
normal output. This is a synonym for
output that results from running the test file into the file
named by the --result-file option,
if that option is given. It is an error to use this option
without also using
specifies the file for test case expected results.
--result-file, together with
--record, determines how mysqltest
treats the test actual and expected results for a test
• If the
test produces no results, mysqltest exits with an
error message to that effect, unless
--result-file is given and the
named file is an empty file.
Otherwise, if --result-file is not
given, mysqltest sends test results to the standard
--result-file but not
--record, mysqltest reads the
expected results from the given file and compares them with
the actual results. If the results do not match,
mysqltest writes a .reject file in the same directory
as the result file, outputs a diff of the two files, and
exits with an error.
both --result-file and
--record, mysqltest updates the
given file by writing the actual test results to it.
argument as an argument to the embedded server. For example,
Up to 64 arguments can be given.
for the embedded server from the given file. The file should
contain one argument per line.
The path name
to a file containing the server RSA public key. The file
must be in PEM format. The public key is used for RSA
encryption of the client password for connections to the
server made using accounts that authenticate with the
sha256_password plugin. This option is ignored for client
accounts that do not authenticate with that plugin. It is
also ignored if password encryption is not needed, as is the
case when the client connects to the server using an SSL
sends the public key to the client as needed, so it is not
necessary to use this option for RSA password encryption to
occur. It is more efficient to do so because then the server
need not send the key.
discussion regarding use of the sha256_password plugin,
including how to get the RSA public key, see
The SHA-256 Authentication
option is available only if MySQL was built using OpenSSL.
It was added in MySQL 5.6.6 under the name
renamed in 5.6.7 to
all normal output.
not use memory allocation checking.
all sleep commands in the test case file to sleep num
seconds. This option does not affect real_sleep
of MySQL 5.0.23, an option value of 0 can be used, which
effectively disables sleep commands in the test
socket file to use when connecting to localhost (which is
the default host).
DML statements within a stored procedure. For every DML
statement, mysqltest creates and invokes a stored
procedure that executes the statement rather than executing
the statement directly.
how many lines of the result to include in the output if the
test fails because an SQL statement fails. The default is 0,
meaning no lines of result printed.
test input from this file. The default is to read from the
given, the number of millisecond spent running the test will
be written to this file. This is used by
mysql-test-run.pl for its
temporary directory where socket files are
MySQL user name to use when connecting to the
mode. Print out more information about what the program
version information and exit.
SELECT statement is wrapped inside a view. This option was
added in MySQL 5.0.19.
Copyright © 2006, 2013, Oracle and/or
its affiliates. All rights reserved.
This software and related documentation are
provided under a license agreement containing restrictions on use
and disclosure and are protected by intellectual property laws.
Except as expressly permitted in your license agreement or
allowed by law, you may not use, copy, reproduce, translate,
broadcast, modify, license, transmit, distribute, exhibit,
perform, publish, or display any part, in any form, or by any
means. Reverse engineering, disassembly, or decompilation of this
software, unless required by law for interoperability, is
The information contained herein is subject
to change without notice and is not warranted to be error-free.
If you find any errors, please report them to us in
If this software or related documentation
is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, the following notice is
U.S. GOVERNMENT RIGHTS Programs, software,
databases, and related documentation and technical data delivered
to U.S. Government customers are "commercial computer software"
or "commercial technical data" pursuant to the applicable Federal
Acquisition Regulation and agency-specific supplemental
regulations. As such, the use, duplication, disclosure,
modification, and adaptation shall be subject to the restrictions
and license terms set forth in the applicable Government
contract, and, to the extent applicable by the terms of the
Government contract, the additional rights set forth in FAR
52.227-19, Commercial Computer Software License (December 2007).
Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA
This software is developed for general use
in a variety of information management applications. It is not
developed or intended for use in any inherently dangerous
applications, including applications which may create a risk of
personal injury. If you use this software in dangerous
applications, then you shall be responsible to take all
appropriate fail-safe, backup, redundancy, and other measures to
ensure the safe use of this software. Oracle Corporation and its
affiliates disclaim any liability for any damages caused by use
of this software in dangerous applications.
Oracle is a registered trademark of Oracle
Corporation and/or its affiliates. MySQL is a trademark of Oracle
Corporation and/or its affiliates, and shall not be used without
Oracle’s express written authorization. Other names may be
trademarks of their respective owners.
This software and documentation may provide
access to or information on content, products, and services from
third parties. Oracle Corporation and its affiliates are not
responsible for and expressly disclaim all warranties of any kind
with respect to third-party content, products, and services.
Oracle Corporation and its affiliates will not be responsible for
any loss, costs, or damages incurred due to your access to or use
of third-party content, products, or services.
This documentation is in prerelease status
and is intended for demonstration and preliminary use only. It
may not be specific to the hardware on which you are using the
software. Oracle Corporation and its affiliates are not
responsible for and expressly disclaim all warranties of any kind
with respect to this documentation and will not be responsible
for any loss, costs, or damages incurred due to the use of this
The information contained in this document
is for informational sharing purposes only and should be
considered in your capacity as a customer advisory board member
or pursuant to your beta trial agreement only. It is not a
commitment to deliver any material, code, or functionality, and
should not be relied upon in making purchasing decisions. The
development, release, and timing of any features or functionality
described in this document remains at the sole discretion of
This document in any form, software or
printed matter, contains proprietary information that is the
exclusive property of Oracle. Your access to and use of this
material is subject to the terms and conditions of your Oracle
Software License and Service Agreement, which has been executed
and with which you agree to comply. This document and information
contained herein may not be disclosed, copied, reproduced, or
distributed to anyone outside Oracle without prior written
consent of Oracle or as specifically provided below. This
document is not part of your license agreement nor can it be
incorporated into any contractual agreement with Oracle or its
subsidiaries or affiliates.
This documentation is NOT distributed under
a GPL license. Use of this documentation is subject to the
You may create a printed copy of this
documentation solely for your own personal use. Conversion to
other formats is allowed as long as the actual content is not
altered or edited in any way. You shall not publish or distribute
this documentation in any form or on any media, except if you
distribute the documentation in a manner similar to how Oracle
disseminates it (that is, electronically for download on a Web
site with the software) or on a CD-ROM or similar medium,
provided however that the documentation is disseminated together
with the software on the same medium. Any other use, such as any
dissemination of printed copies or use of this documentation, in
whole or in part, in another publication, requires the prior
written consent from an authorized representative of Oracle.
Oracle and/or its affiliates reserve any and all rights to this
documentation not expressly granted above.
For more information on the terms of this
license, or for details on how the MySQL documentation is built
and produced, please visit MySQL
Contact & Questions.
For help with using MySQL, please visit
either the MySQL
Forums or MySQL Mailing Lists where you can discuss your issues with other MySQL
For additional documentation on MySQL
products, including translations of the documentation into other
languages, and downloadable versions in variety of formats,
including HTML and PDF formats, see the MySQL Documentation Library.
The SHA-256 Authentication Plugin
more information, please refer to the MySQL Reference
Manual, which may already be installed locally and which is
also available online at