1MYSQLSLAP(1)                 MySQL Database System                MYSQLSLAP(1)
2
3
4

NAME

6       mysqlslap - a load emulation client
7

SYNOPSIS

9       mysqlslap [options]
10

DESCRIPTION

12       mysqlslap is a diagnostic program designed to emulate client load for a
13       MySQL server and to report the timing of each stage. It works as if
14       multiple clients are accessing the server.
15
16       Invoke mysqlslap like this:
17
18           mysqlslap [options]
19
20       Some options such as --create or --query enable you to specify a string
21       containing an SQL statement or a file containing statements. If you
22       specify a file, by default it must contain one statement per line.
23       (That is, the implicit statement delimiter is the newline character.)
24       Use the --delimiter option to specify a different delimiter, which
25       enables you to specify statements that span multiple lines or place
26       multiple statements on a single line. You cannot include comments in a
27       file; mysqlslap does not understand them.
28
29       mysqlslap runs in three stages:
30
31        1. Create schema, table, and optionally any stored programs or data to
32           use for the test. This stage uses a single client connection.
33
34        2. Run the load test. This stage can use many client connections.
35
36        3. Clean up (disconnect, drop table if specified). This stage uses a
37           single client connection.
38
39       Examples:
40
41       Supply your own create and query SQL statements, with 50 clients
42       querying and 200 selects for each (enter the command on a single line):
43
44           mysqlslap --delimiter=";"
45             --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)"
46             --query="SELECT * FROM a" --concurrency=50 --iterations=200
47
48       Let mysqlslap build the query SQL statement with a table of two INT
49       columns and three VARCHAR columns. Use five clients querying 20 times
50       each. Do not create the table or insert the data (that is, use the
51       previous test's schema and data):
52
53           mysqlslap --concurrency=5 --iterations=20
54             --number-int-cols=2 --number-char-cols=3
55             --auto-generate-sql
56
57       Tell the program to load the create, insert, and query SQL statements
58       from the specified files, where the create.sql file has multiple table
59       creation statements delimited by ';' and multiple insert statements
60       delimited by ';'. The --query file should contain multiple queries
61       delimited by ';'. Run all the load statements, then run all the queries
62       in the query file with five clients (five times each):
63
64           mysqlslap --concurrency=5
65             --iterations=5 --query=query.sql --create=create.sql
66             --delimiter=";"
67
68       mysqlslap supports the following options, which can be specified on the
69       command line or in the [mysqlslap] and [client] groups of an option
70       file. For information about option files used by MySQL programs, see
71       Section 4.2.2.2, “Using Option Files”.
72
73--help, -?  Display a help message and exit.
74
75--auto-generate-sql, -a Generate SQL statements automatically when
76           they are not supplied in files or using command options.
77
78--auto-generate-sql-add-autoincrement Add an AUTO_INCREMENT column
79           to automatically generated tables.
80
81--auto-generate-sql-execute-number=N Specify how many queries to
82           generate automatically.
83
84--auto-generate-sql-guid-primary Add a GUID-based primary key to
85           automatically generated tables.
86
87--auto-generate-sql-load-type=type Specify the test load type. The
88           permissible values are read (scan tables), write (insert into
89           tables), key (read primary keys), update (update primary keys), or
90           mixed (half inserts, half scanning selects). The default is mixed.
91
92--auto-generate-sql-secondary-indexes=N Specify how many secondary
93           indexes to add to automatically generated tables. By default, none
94           are added.
95
96--auto-generate-sql-unique-query-number=N How many different
97           queries to generate for automatic tests. For example, if you run a
98           key test that performs 1000 selects, you can use this option with a
99           value of 1000 to run 1000 unique queries, or with a value of 50 to
100           perform 50 different selects. The default is 10.
101
102--auto-generate-sql-unique-write-number=N How many different
103           queries to generate for --auto-generate-sql-write-number. The
104           default is 10.
105
106--auto-generate-sql-write-number=N How many row inserts to perform.
107           The default is 100.
108
109--commit=N How many statements to execute before committing. The
110           default is 0 (no commits are done).
111
112--compress, -C Compress all information sent between the client and
113           the server if possible. See Section 4.2.8, “Connection Compression
114           Control”.
115
116           As of MySQL 8.0.18, this option is deprecated. Expect it to be
117           removed in a future version of MySQL. See the section called
118           “Configuring Legacy Connection Compression”.
119
120--compression-algorithms=value The permitted compression algorithms
121           for connections to the server. The available algorithms are the
122           same as for the protocol_compression_algorithms system variable.
123           The default value is uncompressed.
124
125           For more information, see Section 4.2.8, “Connection Compression
126           Control”.
127
128           This option was added in MySQL 8.0.18.
129
130--concurrency=N, -c N The number of parallel clients to simulate.
131
132--create=value The file or string containing the statement to use
133           for creating the table.
134
135--create-schema=value The schema in which to run the tests.
136
137               Note
138               If the --auto-generate-sql option is also given, mysqlslap
139               drops the schema at the end of the test run. To avoid this, use
140               the --no-drop option as well.
141
142--csv[=file_name] Generate output in comma-separated values format.
143           The output goes to the named file, or to the standard output if no
144           file is given.
145
146--debug[=debug_options], -# [debug_options] Write a debugging log.
147           A typical debug_options string is d:t:o,file_name. The default is
148           d:t:o,/tmp/mysqlslap.trace.
149
150           This option is available only if MySQL was built using WITH_DEBUG.
151           MySQL release binaries provided by Oracle are not built using this
152           option.
153
154--debug-check Print some debugging information when the program
155           exits.
156
157           This option is available only if MySQL was built using WITH_DEBUG.
158           MySQL release binaries provided by Oracle are not built using this
159           option.
160
161--debug-info, -T Print debugging information and memory and CPU
162           usage statistics when the program exits.
163
164           This option is available only if MySQL was built using WITH_DEBUG.
165           MySQL release binaries provided by Oracle are not built using this
166           option.
167
168--default-auth=plugin A hint about which client-side authentication
169           plugin to use. See Section 6.2.17, “Pluggable Authentication”.
170
171--defaults-extra-file=file_name Read this option file after the
172           global option file but (on Unix) before the user option file. If
173           the file does not exist or is otherwise inaccessible, an error
174           occurs. If file_name is not an absolute path name, it is
175           interpreted relative to the current directory.
176
177           For additional information about this and other option-file
178           options, see Section 4.2.2.3, “Command-Line Options that Affect
179           Option-File Handling”.
180
181--defaults-file=file_name Use only the given option file. If the
182           file does not exist or is otherwise inaccessible, an error occurs.
183           If file_name is not an absolute path name, it is interpreted
184           relative to the current directory.
185
186           Exception: Even with --defaults-file, client programs read
187           .mylogin.cnf.
188
189           For additional information about this and other option-file
190           options, see Section 4.2.2.3, “Command-Line Options that Affect
191           Option-File Handling”.
192
193--defaults-group-suffix=str Read not only the usual option groups,
194           but also groups with the usual names and a suffix of str. For
195           example, mysqlslap normally reads the [client] and [mysqlslap]
196           groups. If this option is given as --defaults-group-suffix=_other,
197           mysqlslap also reads the [client_other] and [mysqlslap_other]
198           groups.
199
200           For additional information about this and other option-file
201           options, see Section 4.2.2.3, “Command-Line Options that Affect
202           Option-File Handling”.
203
204--delimiter=str, -F str The delimiter to use in SQL statements
205           supplied in files or using command options.
206
207--detach=N Detach (close and reopen) each connection after each N
208           statements. The default is 0 (connections are not detached).
209
210--enable-cleartext-plugin Enable the mysql_clear_password cleartext
211           authentication plugin. (See Section 6.4.1.4, “Client-Side Cleartext
212           Pluggable Authentication”.)
213
214--engine=engine_name, -e engine_name The storage engine to use for
215           creating tables.
216
217--get-server-public-key Request from the server the RSA public key
218           that it uses for key pair-based password exchange. This option
219           applies to clients that connect to the server using an account that
220           authenticates with the caching_sha2_password authentication plugin.
221           For connections by such accounts, the server does not send the
222           public key to the client unless requested. The option is ignored
223           for accounts that do not authenticate with that plugin. It is also
224           ignored if RSA-based password exchange is not needed, as is the
225           case when the client connects to the server using a secure
226           connection.
227
228           If --server-public-key-path=file_name is given and specifies a
229           valid public key file, it takes precedence over
230           --get-server-public-key.
231
232           For information about the caching_sha2_password plugin, see
233           Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
234
235--host=host_name, -h host_name Connect to the MySQL server on the
236           given host.
237
238--iterations=N, -i N The number of times to run the tests.
239
240--login-path=name Read options from the named login path in the
241           .mylogin.cnf login path file. A “login path” is an option group
242           containing options that specify which MySQL server to connect to
243           and which account to authenticate as. To create or modify a login
244           path file, use the mysql_config_editor utility. See
245           mysql_config_editor(1).
246
247           For additional information about this and other option-file
248           options, see Section 4.2.2.3, “Command-Line Options that Affect
249           Option-File Handling”.
250
251--no-drop Prevent mysqlslap from dropping any schema it creates
252           during the test run.
253
254--no-defaults Do not read any option files. If program startup
255           fails due to reading unknown options from an option file,
256           --no-defaults can be used to prevent them from being read.
257
258           The exception is that the .mylogin.cnf file is read in all cases,
259           if it exists. This permits passwords to be specified in a safer way
260           than on the command line even when --no-defaults is used. To create
261           .mylogin.cnf, use the mysql_config_editor utility. See
262           mysql_config_editor(1).
263
264           For additional information about this and other option-file
265           options, see Section 4.2.2.3, “Command-Line Options that Affect
266           Option-File Handling”.
267
268--number-char-cols=N, -x N The number of VARCHAR columns to use if
269           --auto-generate-sql is specified.
270
271--number-int-cols=N, -y N The number of INT columns to use if
272           --auto-generate-sql is specified.
273
274--number-of-queries=N Limit each client to approximately this many
275           queries. Query counting takes into account the statement delimiter.
276           For example, if you invoke mysqlslap as follows, the ; delimiter is
277           recognized so that each instance of the query string counts as two
278           queries. As a result, 5 rows (not 10) are inserted.
279
280               mysqlslap --delimiter=";" --number-of-queries=10
281                         --query="use test;insert into t values(null)"
282
283--only-print Do not connect to databases.  mysqlslap only prints
284           what it would have done.
285
286--password[=password], -p[password] The password of the MySQL
287           account used for connecting to the server. The password value is
288           optional. If not given, mysqlslap prompts for one. If given, there
289           must be no space between --password= or -p and the password
290           following it. If no password option is specified, the default is to
291           send no password.
292
293           Specifying a password on the command line should be considered
294           insecure. To avoid giving the password on the command line, use an
295           option file. See Section 6.1.2.1, “End-User Guidelines for Password
296           Security”.
297
298           To explicitly specify that there is no password and that mysqlslap
299           should not prompt for one, use the --skip-password option.
300
301--password1[=pass_val] The password for multifactor authentication
302           factor 1 of the MySQL account used for connecting to the server.
303           The password value is optional. If not given, mysqlslap prompts for
304           one. If given, there must be no space between --password1= and the
305           password following it. If no password option is specified, the
306           default is to send no password.
307
308           Specifying a password on the command line should be considered
309           insecure. To avoid giving the password on the command line, use an
310           option file. See Section 6.1.2.1, “End-User Guidelines for Password
311           Security”.
312
313           To explicitly specify that there is no password and that mysqlslap
314           should not prompt for one, use the --skip-password1 option.
315
316           --password1 and --password are synonymous, as are --skip-password1
317           and --skip-password.
318
319--password2[=pass_val] The password for multifactor authentication
320           factor 2 of the MySQL account used for connecting to the server.
321           The semantics of this option are similar to the semantics for
322           --password1; see the description of that option for details.
323
324--password3[=pass_val] The password for multifactor authentication
325           factor 3 of the MySQL account used for connecting to the server.
326           The semantics of this option are similar to the semantics for
327           --password1; see the description of that option for details.
328
329--pipe, -W On Windows, connect to the server using a named pipe.
330           This option applies only if the server was started with the
331           named_pipe system variable enabled to support named-pipe
332           connections. In addition, the user making the connection must be a
333           member of the Windows group specified by the
334           named_pipe_full_access_group system variable.
335
336--plugin-dir=dir_name The directory in which to look for plugins.
337           Specify this option if the --default-auth option is used to specify
338           an authentication plugin but mysqlslap does not find it. See
339           Section 6.2.17, “Pluggable Authentication”.
340
341--port=port_num, -P port_num For TCP/IP connections, the port
342           number to use.
343
344--post-query=value The file or string containing the statement to
345           execute after the tests have completed. This execution is not
346           counted for timing purposes.
347
348--post-system=str The string to execute using system() after the
349           tests have completed. This execution is not counted for timing
350           purposes.
351
352--pre-query=value The file or string containing the statement to
353           execute before running the tests. This execution is not counted for
354           timing purposes.
355
356--pre-system=str The string to execute using system() before
357           running the tests. This execution is not counted for timing
358           purposes.
359
360--print-defaults Print the program name and all options that it
361           gets from option files.
362
363           For additional information about this and other option-file
364           options, see Section 4.2.2.3, “Command-Line Options that Affect
365           Option-File Handling”.
366
367--protocol={TCP|SOCKET|PIPE|MEMORY} The transport protocol to use
368           for connecting to the server. It is useful when the other
369           connection parameters normally result in use of a protocol other
370           than the one you want. For details on the permissible values, see
371           Section 4.2.7, “Connection Transport Protocols”.
372
373--query=value, -q value The file or string containing the SELECT
374           statement to use for retrieving data.
375
376--server-public-key-path=file_name The path name to a file in PEM
377           format containing a client-side copy of the public key required by
378           the server for RSA key pair-based password exchange. This option
379           applies to clients that authenticate with the sha256_password or
380           caching_sha2_password authentication plugin. This option is ignored
381           for accounts that do not authenticate with one of those plugins. It
382           is also ignored if RSA-based password exchange is not used, as is
383           the case when the client connects to the server using a secure
384           connection.
385
386           If --server-public-key-path=file_name is given and specifies a
387           valid public key file, it takes precedence over
388           --get-server-public-key.
389
390           For sha256_password, this option applies only if MySQL was built
391           using OpenSSL.
392
393           For information about the sha256_password and caching_sha2_password
394           plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”,
395           and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
396
397--shared-memory-base-name=name On Windows, the shared-memory name
398           to use for connections made using shared memory to a local server.
399           The default value is MYSQL. The shared-memory name is
400           case-sensitive.
401
402           This option applies only if the server was started with the
403           shared_memory system variable enabled to support shared-memory
404           connections.
405
406--silent, -s Silent mode. No output.
407
408--socket=path, -S path For connections to localhost, the Unix
409           socket file to use, or, on Windows, the name of the named pipe to
410           use.
411
412           On Windows, this option applies only if the server was started with
413           the named_pipe system variable enabled to support named-pipe
414           connections. In addition, the user making the connection must be a
415           member of the Windows group specified by the
416           named_pipe_full_access_group system variable.
417
418--sql-mode=mode Set the SQL mode for the client session.
419
420--ssl* Options that begin with --ssl specify whether to connect to
421           the server using encryption and indicate where to find SSL keys and
422           certificates. See the section called “Command Options for Encrypted
423           Connections”.
424
425--ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
426           mode on the client side. The --ssl-fips-mode option differs from
427           other --ssl-xxx options in that it is not used to establish
428           encrypted connections, but rather to affect which cryptographic
429           operations to permit. See Section 6.8, “FIPS Support”.
430
431           These --ssl-fips-mode values are permitted:
432
433           •   OFF: Disable FIPS mode.
434
435           •   ON: Enable FIPS mode.
436
437           •   STRICT: Enable “strict” FIPS mode.
438
439
440               Note
441               If the OpenSSL FIPS Object Module is not available, the only
442               permitted value for --ssl-fips-mode is OFF. In this case,
443               setting --ssl-fips-mode to ON or STRICT causes the client to
444               produce a warning at startup and to operate in non-FIPS mode.
445
446--tls-ciphersuites=ciphersuite_list The permissible ciphersuites
447           for encrypted connections that use TLSv1.3. The value is a list of
448           one or more colon-separated ciphersuite names. The ciphersuites
449           that can be named for this option depend on the SSL library used to
450           compile MySQL. For details, see Section 6.3.2, “Encrypted
451           Connection TLS Protocols and Ciphers”.
452
453           This option was added in MySQL 8.0.16.
454
455--tls-version=protocol_list The permissible TLS protocols for
456           encrypted connections. The value is a list of one or more
457           comma-separated protocol names. The protocols that can be named for
458           this option depend on the SSL library used to compile MySQL. For
459           details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
460           Ciphers”.
461
462--user=user_name, -u user_name The user name of the MySQL account
463           to use for connecting to the server.
464
465--verbose, -v Verbose mode. Print more information about what the
466           program does. This option can be used multiple times to increase
467           the amount of information.
468
469--version, -V Display version information and exit.
470
471--zstd-compression-level=level The compression level to use for
472           connections to the server that use the zstd compression algorithm.
473           The permitted levels are from 1 to 22, with larger values
474           indicating increasing levels of compression. The default zstd
475           compression level is 3. The compression level setting has no effect
476           on connections that do not use zstd compression.
477
478           For more information, see Section 4.2.8, “Connection Compression
479           Control”.
480
481           This option was added in MySQL 8.0.18.
482
484       Copyright © 1997, 2022, Oracle and/or its affiliates.
485
486       This documentation is free software; you can redistribute it and/or
487       modify it only under the terms of the GNU General Public License as
488       published by the Free Software Foundation; version 2 of the License.
489
490       This documentation is distributed in the hope that it will be useful,
491       but WITHOUT ANY WARRANTY; without even the implied warranty of
492       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
493       General Public License for more details.
494
495       You should have received a copy of the GNU General Public License along
496       with the program; if not, write to the Free Software Foundation, Inc.,
497       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
498       http://www.gnu.org/licenses/.
499
500

SEE ALSO

502       For more information, please refer to the MySQL Reference Manual, which
503       may already be installed locally and which is also available online at
504       http://dev.mysql.com/doc/.
505

AUTHOR

507       Oracle Corporation (http://dev.mysql.com/).
508
509
510
511MySQL 8.0                         08/29/2022                      MYSQLSLAP(1)
Impressum