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 shell> 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 • --pipe, -W On Windows, connect to the server using a named pipe.
411 This option applies only if the server was started with the
412 named_pipe system variable enabled to support named-pipe
413 connections. In addition, the user making the connection must be a
414 member of the Windows group specified by the
415 named_pipe_full_access_group system variable.
416
417 • --plugin-dir=dir_name The directory in which to look for plugins.
418 Specify this option if the --default-auth option is used to specify
419 an authentication plugin but mysqladmin does not find it. See
420 Section 6.2.17, “Pluggable Authentication”.
421
422 • --port=port_num, -P port_num For TCP/IP connections, the port
423 number to use.
424
425 • --print-defaults Print the program name and all options that it
426 gets from option files.
427
428 For additional information about this and other option-file
429 options, see Section 4.2.2.3, “Command-Line Options that Affect
430 Option-File Handling”.
431
432 • --protocol={TCP|SOCKET|PIPE|MEMORY} The transport protocol to use
433 for connecting to the server. It is useful when the other
434 connection parameters normally result in use of a protocol other
435 than the one you want. For details on the permissible values, see
436 Section 4.2.7, “Connection Transport Protocols”.
437
438 • --relative, -r Show the difference between the current and previous
439 values when used with the --sleep option. This option works only
440 with the extended-status command.
441
442 • --server-public-key-path=file_name The path name to a file in PEM
443 format containing a client-side copy of the public key required by
444 the server for RSA key pair-based password exchange. This option
445 applies to clients that authenticate with the sha256_password or
446 caching_sha2_password authentication plugin. This option is ignored
447 for accounts that do not authenticate with one of those plugins. It
448 is also ignored if RSA-based password exchange is not used, as is
449 the case when the client connects to the server using a secure
450 connection.
451
452 If --server-public-key-path=file_name is given and specifies a
453 valid public key file, it takes precedence over
454 --get-server-public-key.
455
456 For sha256_password, this option applies only if MySQL was built
457 using OpenSSL.
458
459 For information about the sha256_password and caching_sha2_password
460 plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”,
461 and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
462
463 • --shared-memory-base-name=name On Windows, the shared-memory name
464 to use for connections made using shared memory to a local server.
465 The default value is MYSQL. The shared-memory name is
466 case-sensitive.
467
468 This option applies only if the server was started with the
469 shared_memory system variable enabled to support shared-memory
470 connections.
471
472 • --show-warnings Show warnings resulting from execution of
473 statements sent to the server.
474
475 • --shutdown-timeout=value The maximum number of seconds to wait for
476 server shutdown. The default value is 3600 (1 hour).
477
478 • --silent, -s Exit silently if a connection to the server cannot be
479 established.
480
481 • --sleep=delay, -i delay Execute commands repeatedly, sleeping for
482 delay seconds in between. The --count option determines the number
483 of iterations. If --count is not given, mysqladmin executes
484 commands indefinitely until interrupted.
485
486 • --socket=path, -S path For connections to localhost, the Unix
487 socket file to use, or, on Windows, the name of the named pipe to
488 use.
489
490 On Windows, this option applies only if the server was started with
491 the named_pipe system variable enabled to support named-pipe
492 connections. In addition, the user making the connection must be a
493 member of the Windows group specified by the
494 named_pipe_full_access_group system variable.
495
496 • --ssl* Options that begin with --ssl specify whether to connect to
497 the server using encryption and indicate where to find SSL keys and
498 certificates. See the section called “Command Options for Encrypted
499 Connections”.
500
501 • --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
502 mode on the client side. The --ssl-fips-mode option differs from
503 other --ssl-xxx options in that it is not used to establish
504 encrypted connections, but rather to affect which cryptographic
505 operations to permit. See Section 6.8, “FIPS Support”.
506
507 These --ssl-fips-mode values are permitted:
508
509 • OFF: Disable FIPS mode.
510
511 • ON: Enable FIPS mode.
512
513 • STRICT: Enable “strict” FIPS mode.
514
515
516 Note
517 If the OpenSSL FIPS Object Module is not available, the only
518 permitted value for --ssl-fips-mode is OFF. In this case,
519 setting --ssl-fips-mode to ON or STRICT causes the client to
520 produce a warning at startup and to operate in non-FIPS mode.
521
522 • --tls-ciphersuites=ciphersuite_list The permissible ciphersuites
523 for encrypted connections that use TLSv1.3. The value is a list of
524 one or more colon-separated ciphersuite names. The ciphersuites
525 that can be named for this option depend on the SSL library used to
526 compile MySQL. For details, see Section 6.3.2, “Encrypted
527 Connection TLS Protocols and Ciphers”.
528
529 This option was added in MySQL 8.0.16.
530
531 • --tls-version=protocol_list The permissible TLS protocols for
532 encrypted connections. The value is a list of one or more
533 comma-separated protocol names. The protocols that can be named for
534 this option depend on the SSL library used to compile MySQL. For
535 details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
536 Ciphers”.
537
538 • --user=user_name, -u user_name The user name of the MySQL account
539 to use for connecting to the server.
540
541 • --verbose, -v Verbose mode. Print more information about what the
542 program does.
543
544 • --version, -V Display version information and exit.
545
546 • --vertical, -E Print output vertically. This is similar to
547 --relative, but prints output vertically.
548
549 • --wait[=count], -w[count] If the connection cannot be established,
550 wait and retry instead of aborting. If a count value is given, it
551 indicates the number of times to retry. The default is one time.
552
553 • --zstd-compression-level=level The compression level to use for
554 connections to the server that use the zstd compression algorithm.
555 The permitted levels are from 1 to 22, with larger values
556 indicating increasing levels of compression. The default zstd
557 compression level is 3. The compression level setting has no effect
558 on connections that do not use zstd compression.
559
560 For more information, see Section 4.2.8, “Connection Compression
561 Control”.
562
563 This option was added in MySQL 8.0.18.
564
566 Copyright © 1997, 2021, Oracle and/or its affiliates.
567
568 This documentation is free software; you can redistribute it and/or
569 modify it only under the terms of the GNU General Public License as
570 published by the Free Software Foundation; version 2 of the License.
571
572 This documentation is distributed in the hope that it will be useful,
573 but WITHOUT ANY WARRANTY; without even the implied warranty of
574 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
575 General Public License for more details.
576
577 You should have received a copy of the GNU General Public License along
578 with the program; if not, write to the Free Software Foundation, Inc.,
579 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
580 http://www.gnu.org/licenses/.
581
582
584 For more information, please refer to the MySQL Reference Manual, which
585 may already be installed locally and which is also available online at
586 http://dev.mysql.com/doc/.
587
589 Oracle Corporation (http://dev.mysql.com/).
590
591
592
593MySQL 8.0 09/04/2021 MYSQLADMIN(1)