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