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

NAME

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

SEE ALSO

519       For more information, please refer to the MySQL Reference Manual, which
520       may already be installed locally and which is also available online at
521       http://dev.mysql.com/doc/.
522

AUTHOR

524       Oracle Corporation (http://dev.mysql.com/).
525
526
527
528MySQL 8.0                         02/20/2019                      MYSQLSLAP(1)
Impressum