mysqltest_embedded - program to run embedded test cases
mysqltest [options] [db_name]
mysqltest_embedded [options] [db_name]
The 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 directly.
mysqltest_embedded is similar but is built with support for the
libmysqld embedded server.
Features of mysqltest:
o Can send SQL statements to MySQL servers for execution
o Can execute external shell commands
o Can test whether the result from an SQL statement or shell command
is as expected
o Can connect to one or more standalone mysqld servers and switch
o Can 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.)
By default, mysqltest reads the test case on the standard input. To run
mysqltest this way, you normally invoke it like this:
shell> mysqltest [options] [db_name] < test_file
You can also name the test case file with a --test-file=file_name
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).
mysqltest supports the following options:
o --help, -?
Display a help message and exit.
o --basedir=dir_name, -b dir_name
The base directory for tests.
o --database=db_name, -D db_name
The default database to use.
o --debug[=debug_options], -#[debug_options]
Write a debugging log if MySQL is built with debugging support. The
default debug_options value is 'd:t:S:i:O,/tmp/mysqltest.trace'.
Print some debugging information when the program exits.
Print debugging information and memory and CPU usage statistics
when the program exits.
Run EXPLAIN EXTENDED on all SELECT, INSERT, REPLACE, UPDATE and
o --host=host_name, -h host_name
Connect to the MySQL server on the given host.
o --include=file_name, -i file_name
Include the 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 file.
Run EXPLAIN FORMAT=JSON on all SELECT, INSERT, REPLACE, UPDATE and
DELETE queries. The json-explain-protocol option is available from
The directory to use for log files.
Write the line number and elapsed time to test_file.progress.
The maximum number of connection attempts when connecting to
The directory 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.
o --password[=password], -p[password]
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
o --port=port_num, -P port_num
The TCP/IP port number to use for the connection.
Choose the protocol for communication with the server. SOCKET is
The --protocol option is ignored if running with the embedded
Use the prepared-statement protocol for communication.
Suppress all normal output. This is a synonym for --silent.
o --record, -r
Record the 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 --result-file.
o --result-file=file_name, -R file_name
This option 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 case:
o 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.
o Otherwise, if --result-file is not given, mysqltest sends test
results to the standard output.
example, --server-arg=--tmpdir=/tmp or --server-arg=--core. Up to
64 arguments can be given.
o --server-file=file_name, -F file_name
Read arguments 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 connection.
The server 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.
For additional discussion regarding use of the sha256_password
plugin, including how to get the RSA public key, see The SHA-256
This option is available only if MySQL was built using OpenSSL. It
was added in MySQL 5.6.6 under the name --server-public-key and
renamed in 5.6.7 to --server-public-key-path.
o --silent, -s
Suppress all normal output.
Do not use memory allocation checking.
o --sleep=num, -T num
Cause all sleep commands in the test case file to sleep num
seconds. This option does not affect real_sleep commands.
An option value of 0 can also be used, which effectively disables
sleep commands in the test case.
o --socket=path, -S path
The socket file to use when connecting to localhost (which is the
o --test-file=file_name, -x file_name
Read test input from this file. The default is to read from the
o --timer-file=file_name, -m file_name
If 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
The protocols permitted by the client for encrypted connections.
The value is a comma-separated list containing one or more of these
protocols: TLSv1, TLSv1.1, TLSv1.2. (TLSv1.2 is supported only if
MySQL was compiled using OpenSSL 1.0.1 or higher. It is not
supported if MySQL was compiled using yaSSL.)
This option was added in MySQL 5.7.10.
o --tmpdir=dir_name, -t dir_name
The temporary directory where socket files are created.
If enabled, this option causes mysqltest to immediately display the
output from executed programs to stdout.
This option was added in MySQL 8.0.0.
o --user=user_name, -u user_name
The MySQL user name to use when connecting to the server.
o --verbose, -v
Verbose mode. Print out more information about what the program
o --version, -V
Display version information and exit.
Every SELECT statement is wrapped inside a view.
Copyright (C) 2006, 2016, Oracle and/or its affiliates. All rights
This documentation is free software; you can redistribute it and/or
1. The SHA-256 Authentication Plugin
For more information, please refer to the MySQL Reference Manual, which
may already be installed locally and which is also available online at
Oracle Corporation (http://dev.mysql.com/).
MySQL 11/25/2016 MYSQLTEST(1)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2017
All Rights Reserved.