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