1MYSQLADMIN(1) MySQL Database System MYSQLADMIN(1)
2
3
4
6 mysqladmin - client for administering a MySQL server
7
9 mysqladmin [options] command [command-options] [command
10 [command-options]]
11 ...
12
14 mysqladmin is a client for performing administrative operations. You
15 can use it to check the server's configuration and current status, to
16 create and drop databases, and more.
17
18 Invoke mysqladmin like this:
19
20 shell> mysqladmin [options] command [command-arg] [command [command-arg]] ...
21
22 mysqladmin supports the following commands. Some of the commands take
23 an argument following the command name.
24
25 · create db_name
26
27 Create a new database named db_name.
28
29 · debug
30
31 Tell the server to write debug information to the error log. The
32 connected user must have the SUPER privilege. Format and content of
33 this information is subject to change.
34
35 This includes information about the Event Scheduler. See
36 Section 24.4.5, “Event Scheduler Status”.
37
38 · drop db_name
39
40 Delete the database named db_name and all its tables.
41
42 · extended-status
43
44 Display the server status variables and their values.
45
46 · flush-hosts
47
48 Flush all information in the host cache. See Section 8.12.4.2, “DNS
49 Lookup Optimization and the Host Cache”.
50
51 · flush-logs [log_type ...]
52
53 Flush all logs.
54
55 The mysqladmin flush-logs command permits optional log types to be
56 given, to specify which logs to flush. Following the flush-logs
57 command, you can provide a space-separated list of one or more of
58 the following log types: binary, engine, error, general, relay,
59 slow. These correspond to the log types that can be specified for
60 the FLUSH LOGS SQL statement.
61
62 · flush-privileges
63
64 Reload the grant tables (same as reload).
65
66 · flush-status
67
68 Clear status variables.
69
70 · flush-tables
71
72 Flush all tables.
73
74 · flush-threads
75
76 Flush the thread cache.
77
78 · kill id,id,...
79
80 Kill server threads. If multiple thread ID values are given, there
81 must be no spaces in the list.
82
83 To kill threads belonging to other users, the connected user must
84 have the CONNECTION_ADMIN or SUPER privilege.
85
86 · password new_password
87
88 Set a new password. This changes the password to new_password for
89 the account that you use with mysqladmin for connecting to the
90 server. Thus, the next time you invoke mysqladmin (or any other
91 client program) using the same account, you will need to specify
92 the new password.
93
94 Warning
95 Setting a password using mysqladmin should be considered
96 insecure. On some systems, your password becomes visible to
97 system status programs such as ps that may be invoked by other
98 users to display command lines. MySQL clients typically
99 overwrite the command-line password argument with zeros during
100 their initialization sequence. However, there is still a brief
101 interval during which the value is visible. Also, on some
102 systems this overwriting strategy is ineffective and the
103 password remains visible to ps. (SystemV Unix systems and
104 perhaps others are subject to this problem.)
105 If the new_password value contains spaces or other characters that
106 are special to your command interpreter, you need to enclose it
107 within quotation marks. On Windows, be sure to use double quotation
108 marks rather than single quotation marks; single quotation marks
109 are not stripped from the password, but rather are interpreted as
110 part of the password. For example:
111
112 shell> mysqladmin password "my new password"
113
114 The new password can be omitted following the password command. In
115 this case, mysqladmin prompts for the password value, which enables
116 you to avoid specifying the password on the command line. Omitting
117 the password value should be done only if password is the final
118 command on the mysqladmin command line. Otherwise, the next
119 argument is taken as the password.
120
121 Caution
122 Do not use this command used if the server was started with the
123 --skip-grant-tables option. No password change will be applied.
124 This is true even if you precede the password command with
125 flush-privileges on the same command line to re-enable the
126 grant tables because the flush operation occurs after you
127 connect. However, you can use mysqladmin flush-privileges to
128 re-enable the grant table and then use a separate mysqladmin
129 password command to change the password.
130
131 · ping
132
133 Check whether the server is available. The return status from
134 mysqladmin is 0 if the server is running, 1 if it is not. This is 0
135 even in case of an error such as Access denied, because this means
136 that the server is running but refused the connection, which is
137 different from the server not running.
138
139 · processlist
140
141 Show a list of active server threads. This is like the output of
142 the SHOW PROCESSLIST statement. If the --verbose option is given,
143 the output is like that of SHOW FULL PROCESSLIST. (See
144 Section 13.7.7.29, “SHOW PROCESSLIST Statement”.)
145
146 · reload
147
148 Reload the grant tables.
149
150 · refresh
151
152 Flush all tables and close and open log files.
153
154 · shutdown
155
156 Stop the server.
157
158 · start-slave
159
160 Start replication on a slave server.
161
162 · status
163
164 Display a short server status message.
165
166 · stop-slave
167
168 Stop replication on a slave server.
169
170 · variables
171
172 Display the server system variables and their values.
173
174 · version
175
176 Display version information from the server.
177
178 All commands can be shortened to any unique prefix. For example:
179
180 shell> mysqladmin proc stat
181 +----+-------+-----------+----+---------+------+-------+------------------+
182 | Id | User | Host | db | Command | Time | State | Info |
183 +----+-------+-----------+----+---------+------+-------+------------------+
184 | 51 | jones | localhost | | Query | 0 | | show processlist |
185 +----+-------+-----------+----+---------+------+-------+------------------+
186 Uptime: 1473624 Threads: 1 Questions: 39487
187 Slow queries: 0 Opens: 541 Flush tables: 1
188 Open tables: 19 Queries per second avg: 0.0268
189
190 The mysqladmin status command result displays the following values:
191
192 · Uptime
193
194 The number of seconds the MySQL server has been running.
195
196 · Threads
197
198 The number of active threads (clients).
199
200 · Questions
201
202 The number of questions (queries) from clients since the server was
203 started.
204
205 · Slow queries
206
207 The number of queries that have taken more than long_query_time
208 seconds. See Section 5.4.5, “The Slow Query Log”.
209
210 · Opens
211
212 The number of tables the server has opened.
213
214 · Flush tables
215
216 The number of flush-*, refresh, and reload commands the server has
217 executed.
218
219 · Open tables
220
221 The number of tables that currently are open.
222
223 If you execute mysqladmin shutdown when connecting to a local server
224 using a Unix socket file, mysqladmin waits until the server's process
225 ID file has been removed, to ensure that the server has stopped
226 properly.
227
228 mysqladmin supports the following options, which can be specified on
229 the command line or in the [mysqladmin] and [client] groups of an
230 option file. For information about option files used by MySQL programs,
231 see Section 4.2.2.2, “Using Option Files”.
232
233 · --help, -?
234
235 Display a help message and exit.
236
237 · --bind-address=ip_address
238
239 On a computer having multiple network interfaces, use this option
240 to select which interface to use for connecting to the MySQL
241 server.
242
243 · --character-sets-dir=dir_name
244
245 The directory where character sets are installed. See
246 Section 10.15, “Character Set Configuration”.
247
248 · --compress, -C
249
250 Compress all information sent between the client and the server if
251 possible. See Section 4.2.6, “Connection Compression Control”.
252
253 As of MySQL 8.0.18, this option is deprecated. It will be removed
254 in a future MySQL version. See the section called “Legacy
255 Connection Compression Configuration”.
256
257 · --compression-algorithms=value The permitted compression algorithms
258 for connections to the server. The available algorithms are the
259 same as for the protocol_compression_algorithms system variable.
260 The default value is uncompressed.
261
262 For more information, see Section 4.2.6, “Connection Compression
263 Control”.
264
265 This option was added in MySQL 8.0.18.
266
267 · --count=N, -c N
268
269 The number of iterations to make for repeated command execution if
270 the --sleep option is given.
271
272 · --debug[=debug_options], -# [debug_options]
273
274 Write a debugging log. A typical debug_options string is
275 d:t:o,file_name. The default is d:t:o,/tmp/mysqladmin.trace.
276
277 This option is available only if MySQL was built using WITH_DEBUG.
278 MySQL release binaries provided by Oracle are not built using this
279 option.
280
281 · --debug-check
282
283 Print some debugging information when the program exits.
284
285 This option is available only if MySQL was built using WITH_DEBUG.
286 MySQL release binaries provided by Oracle are not built using this
287 option.
288
289 · --debug-info
290
291 Print debugging information and memory and CPU usage statistics
292 when the program exits.
293
294 This option is available only if MySQL was built using WITH_DEBUG.
295 MySQL release binaries provided by Oracle are not built using this
296 option.
297
298 · --default-auth=plugin
299
300 A hint about which client-side authentication plugin to use. See
301 Section 6.2.17, “Pluggable Authentication”.
302
303 · --default-character-set=charset_name
304
305 Use charset_name as the default character set. See Section 10.15,
306 “Character Set Configuration”.
307
308 · --defaults-extra-file=file_name
309
310 Read this option file after the global option file but (on Unix)
311 before the user option file. If the file does not exist or is
312 otherwise inaccessible, an error occurs. file_name is interpreted
313 relative to the current directory if given as a relative path name
314 rather than a full path name.
315
316 For additional information about this and other option-file
317 options, see Section 4.2.2.3, “Command-Line Options that Affect
318 Option-File Handling”.
319
320 · --defaults-file=file_name
321
322 Use only the given option file. If the file does not exist or is
323 otherwise inaccessible, an error occurs. file_name is interpreted
324 relative to the current directory if given as a relative path name
325 rather than a full path name.
326
327 Exception: Even with --defaults-file, client programs read
328 .mylogin.cnf.
329
330 For additional information about this and other option-file
331 options, see Section 4.2.2.3, “Command-Line Options that Affect
332 Option-File Handling”.
333
334 · --defaults-group-suffix=str
335
336 Read not only the usual option groups, but also groups with the
337 usual names and a suffix of str. For example, mysqladmin normally
338 reads the [client] and [mysqladmin] groups. If the
339 --defaults-group-suffix=_other option is given, mysqladmin also
340 reads the [client_other] and [mysqladmin_other] groups.
341
342 For additional information about this and other option-file
343 options, see Section 4.2.2.3, “Command-Line Options that Affect
344 Option-File Handling”.
345
346 · --enable-cleartext-plugin
347
348 Enable the mysql_clear_password cleartext authentication plugin.
349 (See Section 6.4.1.4, “Client-Side Cleartext Pluggable
350 Authentication”.)
351
352 · --force, -f
353
354 Do not ask for confirmation for the drop db_name command. With
355 multiple commands, continue even if an error occurs.
356
357 · --get-server-public-key
358
359 Request from the server the public key required for RSA key
360 pair-based password exchange. This option applies to clients that
361 authenticate with the caching_sha2_password authentication plugin.
362 For that plugin, the server does not send the public key unless
363 requested. This option is ignored for accounts that do not
364 authenticate with that plugin. It is also ignored if RSA-based
365 password exchange is not used, as is the case when the client
366 connects to the server using a secure connection.
367
368 If --server-public-key-path=file_name is given and specifies a
369 valid public key file, it takes precedence over
370 --get-server-public-key.
371
372 For information about the caching_sha2_password plugin, see
373 Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
374
375 · --host=host_name, -h host_name
376
377 Connect to the MySQL server on the given host.
378
379 · --login-path=name
380
381 Read options from the named login path in the .mylogin.cnf login
382 path file. A “login path” is an option group containing options
383 that specify which MySQL server to connect to and which account to
384 authenticate as. To create or modify a login path file, use the
385 mysql_config_editor utility. See mysql_config_editor(1).
386
387 For additional information about this and other option-file
388 options, see Section 4.2.2.3, “Command-Line Options that Affect
389 Option-File Handling”.
390
391 · --no-beep, -b
392
393 Suppress the warning beep that is emitted by default for errors
394 such as a failure to connect to the server.
395
396 · --no-defaults
397
398 Do not read any option files. If program startup fails due to
399 reading unknown options from an option file, --no-defaults can be
400 used to prevent them from being read.
401
402 The exception is that the .mylogin.cnf file, if it exists, is read
403 in all cases. This permits passwords to be specified in a safer way
404 than on the command line even when --no-defaults is used.
405 (.mylogin.cnf is created by the mysql_config_editor utility. See
406 mysql_config_editor(1).)
407
408 For additional information about this and other option-file
409 options, see Section 4.2.2.3, “Command-Line Options that Affect
410 Option-File Handling”.
411
412 · --password[=password], -p[password]
413
414 The password of the MySQL account used for connecting to the
415 server. The password value is optional. If not given, mysqladmin
416 prompts for one. If given, there must be no space between
417 --password= or -p and the password following it. If no password
418 option is specified, the default is to send no password.
419
420 Specifying a password on the command line should be considered
421 insecure. To avoid giving the password on the command line, use an
422 option file. See Section 6.1.2.1, “End-User Guidelines for Password
423 Security”.
424
425 To explicitly specify that there is no password and that mysqladmin
426 should not prompt for one, use the --skip-password option.
427
428 · --pipe, -W
429
430 On Windows, connect to the server using a named pipe. This option
431 applies only if the server was started with the named_pipe system
432 variable enabled to support named-pipe connections. In addition,
433 the user making the connection must be a member of the Windows
434 group specified by the named_pipe_full_access_group system
435 variable.
436
437 · --plugin-dir=dir_name
438
439 The directory in which to look for plugins. Specify this option if
440 the --default-auth option is used to specify an authentication
441 plugin but mysqladmin does not find it. See Section 6.2.17,
442 “Pluggable Authentication”.
443
444 · --port=port_num, -P port_num
445
446 For TCP/IP connections, the port number to use.
447
448 · --print-defaults
449
450 Print the program name and all options that it gets from option
451 files.
452
453 For additional information about this and other option-file
454 options, see Section 4.2.2.3, “Command-Line Options that Affect
455 Option-File Handling”.
456
457 · --protocol={TCP|SOCKET|PIPE|MEMORY}
458
459 The connection protocol to use for connecting to the server. It is
460 useful when the other connection parameters normally result in use
461 of a protocol other than the one you want. For details on the
462 permissible values, see Section 4.2.4, “Connecting to the MySQL
463 Server Using Command Options”.
464
465 · --relative, -r
466
467 Show the difference between the current and previous values when
468 used with the --sleep option. This option works only with the
469 extended-status command.
470
471 · --server-public-key-path=file_name
472
473 The path name to a file containing a client-side copy of the public
474 key required by the server for RSA key pair-based password
475 exchange. The file must be in PEM format. This option applies to
476 clients that authenticate with the sha256_password or
477 caching_sha2_password authentication plugin. This option is ignored
478 for accounts that do not authenticate with one of those plugins. It
479 is also ignored if RSA-based password exchange is not used, as is
480 the case when the client connects to the server using a secure
481 connection.
482
483 If --server-public-key-path=file_name is given and specifies a
484 valid public key file, it takes precedence over
485 --get-server-public-key.
486
487 For sha256_password, this option applies only if MySQL was built
488 using OpenSSL.
489
490 For information about the sha256_password and caching_sha2_password
491 plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”,
492 and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
493
494 · --shared-memory-base-name=name
495
496 On Windows, the shared-memory name to use for connections made
497 using shared memory to a local server. The default value is MYSQL.
498 The shared-memory name is case-sensitive.
499
500 This option applies only if the server was started with the
501 shared_memory system variable enabled to support shared-memory
502 connections.
503
504 · --show-warnings
505
506 Show warnings resulting from execution of statements sent to the
507 server.
508
509 · --silent, -s
510
511 Exit silently if a connection to the server cannot be established.
512
513 · --sleep=delay, -i delay
514
515 Execute commands repeatedly, sleeping for delay seconds in between.
516 The --count option determines the number of iterations. If --count
517 is not given, mysqladmin executes commands indefinitely until
518 interrupted.
519
520 · --socket=path, -S path
521
522 For connections to localhost, the Unix socket file to use, or, on
523 Windows, the name of the named pipe to use.
524
525 On Windows, this option applies only if the server was started with
526 the named_pipe system variable enabled to support named-pipe
527 connections. In addition, the user making the connection must be a
528 member of the Windows group specified by the
529 named_pipe_full_access_group system variable.
530
531 · --ssl*
532
533 Options that begin with --ssl specify whether to connect to the
534 server using SSL and indicate where to find SSL keys and
535 certificates. See the section called “Command Options for Encrypted
536 Connections”.
537
538 · --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
539 mode on the client side. The --ssl-fips-mode option differs from
540 other --ssl-xxx options in that it is not used to establish
541 encrypted connections, but rather to affect which cryptographic
542 operations are permitted. See Section 6.5, “FIPS Support”.
543
544 These --ssl-fips-mode values are permitted:
545
546 · OFF: Disable FIPS mode.
547
548 · ON: Enable FIPS mode.
549
550 · STRICT: Enable “strict” FIPS mode.
551
552
553 Note
554 If the OpenSSL FIPS Object Module is not available, the only
555 permitted value for --ssl-fips-mode is OFF. In this case,
556 setting --ssl-fips-mode to ON or STRICT causes the client to
557 produce a warning at startup and to operate in non-FIPS mode.
558
559 · --tls-ciphersuites=ciphersuite_list
560
561 The permissible ciphersuites for encrypted connections that use
562 TLSv1.3. The value is a list of one or more colon-separated
563 ciphersuite names. The ciphersuites that can be named for this
564 option depend on the SSL library used to compile MySQL. For
565 details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
566 Ciphers”.
567
568 This option was added in MySQL 8.0.16.
569
570 · --tls-version=protocol_list
571
572 The permissible TLS protocols for encrypted connections. The value
573 is a list of one or more comma-separated protocol names. The
574 protocols that can be named for this option depend on the SSL
575 library used to compile MySQL. For details, see Section 6.3.2,
576 “Encrypted Connection TLS Protocols and Ciphers”.
577
578 · --user=user_name, -u user_name
579
580 The user name of the MySQL account to use for connecting to the
581 server.
582
583 · --verbose, -v
584
585 Verbose mode. Print more information about what the program does.
586
587 · --version, -V
588
589 Display version information and exit.
590
591 · --vertical, -E
592
593 Print output vertically. This is similar to --relative, but prints
594 output vertically.
595
596 · --wait[=count], -w[count]
597
598 If the connection cannot be established, wait and retry instead of
599 aborting. If a count value is given, it indicates the number of
600 times to retry. The default is one time.
601
602 · --zstd-compression-level=level The compression level to use for
603 connections to the server that use the zstd compression algorithm.
604 The permitted levels are from 1 to 22, with larger values
605 indicating increasing levels of compression. The default zstd
606 compression level is 3. The compression level setting has no effect
607 on connections that do not use zstd compression.
608
609 For more information, see Section 4.2.6, “Connection Compression
610 Control”.
611
612 This option was added in MySQL 8.0.18.
613
614 You can also set the following variables by using --var_name=value.
615
616 · connect_timeout
617
618 The maximum number of seconds before connection timeout. The
619 default value is 43200 (12 hours).
620
621 · shutdown_timeout
622
623 The maximum number of seconds to wait for server shutdown. The
624 default value is 3600 (1 hour).
625
627 Copyright © 1997, 2020, Oracle and/or its affiliates. All rights
628 reserved.
629
630 This documentation is free software; you can redistribute it and/or
631 modify it only under the terms of the GNU General Public License as
632 published by the Free Software Foundation; version 2 of the License.
633
634 This documentation is distributed in the hope that it will be useful,
635 but WITHOUT ANY WARRANTY; without even the implied warranty of
636 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
637 General Public License for more details.
638
639 You should have received a copy of the GNU General Public License along
640 with the program; if not, write to the Free Software Foundation, Inc.,
641 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
642 http://www.gnu.org/licenses/.
643
644
646 For more information, please refer to the MySQL Reference Manual, which
647 may already be installed locally and which is also available online at
648 http://dev.mysql.com/doc/.
649
651 Oracle Corporation (http://dev.mysql.com/).
652
653
654
655MySQL 8.0 03/06/2020 MYSQLADMIN(1)