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 In MySQL 8.0, the new password can be omitted following the
115 password command. In this case, mysqladmin prompts for the password
116 value, which enables you to avoid specifying the password on the
117 command line. Omitting the password value should be done only if
118 password is the final command on the mysqladmin command line.
119 Otherwise, the next 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.6.29, “SHOW PROCESSLIST Syntax”.)
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 | monty | 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.7, “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.14, “Character Set Configuration”.
247
248 · --compress, -C
249
250 Compress all information sent between the client and the server if
251 both support compression.
252
253 · --count=N, -c N
254
255 The number of iterations to make for repeated command execution if
256 the --sleep option is given.
257
258 · --debug[=debug_options], -# [debug_options]
259
260 Write a debugging log. A typical debug_options string is
261 d:t:o,file_name. The default is d:t:o,/tmp/mysqladmin.trace.
262
263 · --debug-check
264
265 Print some debugging information when the program exits.
266
267 · --debug-info
268
269 Print debugging information and memory and CPU usage statistics
270 when the program exits.
271
272 · --default-auth=plugin
273
274 A hint about the client-side authentication plugin to use. See
275 Section 6.3.10, “Pluggable Authentication”.
276
277 · --default-character-set=charset_name
278
279 Use charset_name as the default character set. See Section 10.14,
280 “Character Set Configuration”.
281
282 · --defaults-extra-file=file_name
283
284 Read this option file after the global option file but (on Unix)
285 before the user option file. If the file does not exist or is
286 otherwise inaccessible, an error occurs. file_name is interpreted
287 relative to the current directory if given as a relative path name
288 rather than a full path name.
289
290 For additional information about this and other option-file
291 options, see Section 4.2.8, “Command-Line Options that Affect
292 Option-File Handling”.
293
294 · --defaults-file=file_name
295
296 Use only the given option file. If the file does not exist or is
297 otherwise inaccessible, an error occurs. file_name is interpreted
298 relative to the current directory if given as a relative path name
299 rather than a full path name.
300
301 Exception: Even with --defaults-file, client programs read
302 .mylogin.cnf.
303
304 For additional information about this and other option-file
305 options, see Section 4.2.8, “Command-Line Options that Affect
306 Option-File Handling”.
307
308 · --defaults-group-suffix=str
309
310 Read not only the usual option groups, but also groups with the
311 usual names and a suffix of str. For example, mysqladmin normally
312 reads the [client] and [mysqladmin] groups. If the
313 --defaults-group-suffix=_other option is given, mysqladmin also
314 reads the [client_other] and [mysqladmin_other] groups.
315
316 For additional information about this and other option-file
317 options, see Section 4.2.8, “Command-Line Options that Affect
318 Option-File Handling”.
319
320 · --enable-cleartext-plugin
321
322 Enable the mysql_clear_password cleartext authentication plugin.
323 (See Section 6.5.1.4, “Client-Side Cleartext Pluggable
324 Authentication”.)
325
326 · --force, -f
327
328 Do not ask for confirmation for the drop db_name command. With
329 multiple commands, continue even if an error occurs.
330
331 · --get-server-public-key
332
333 Request from the server the public key required for RSA key
334 pair-based password exchange. This option applies to clients that
335 that authenticate with the caching_sha2_password authentication
336 plugin. For that plugin, the server does not send the public key
337 unless requested. This option is ignored for accounts that do not
338 authenticate with that plugin. It is also ignored if RSA-based
339 password exchange is not used, as is the case when the client
340 connects to the server using a secure connection.
341
342 If --server-public-key-path=file_name is given and specifies a
343 valid public key file, it takes precedence over
344 --get-server-public-key.
345
346 For information about the caching_sha2_password plugin, see
347 Section 6.5.1.3, “Caching SHA-2 Pluggable Authentication”.
348
349 · --host=host_name, -h host_name
350
351 Connect to the MySQL server on the given host.
352
353 · --login-path=name
354
355 Read options from the named login path in the .mylogin.cnf login
356 path file. A “login path” is an option group containing options
357 that specify which MySQL server to connect to and which account to
358 authenticate as. To create or modify a login path file, use the
359 mysql_config_editor utility. See mysql_config_editor(1).
360
361 For additional information about this and other option-file
362 options, see Section 4.2.8, “Command-Line Options that Affect
363 Option-File Handling”.
364
365 · --no-beep, -b
366
367 Suppress the warning beep that is emitted by default for errors
368 such as a failure to connect to the server.
369
370 · --no-defaults
371
372 Do not read any option files. If program startup fails due to
373 reading unknown options from an option file, --no-defaults can be
374 used to prevent them from being read.
375
376 The exception is that the .mylogin.cnf file, if it exists, is read
377 in all cases. This permits passwords to be specified in a safer way
378 than on the command line even when --no-defaults is used.
379 (.mylogin.cnf is created by the mysql_config_editor utility. See
380 mysql_config_editor(1).)
381
382 For additional information about this and other option-file
383 options, see Section 4.2.8, “Command-Line Options that Affect
384 Option-File Handling”.
385
386 · --password[=password], -p[password]
387
388 The password to use when connecting to the server. If you use the
389 short option form (-p), you cannot have a space between the option
390 and the password. If you omit the password value following the
391 --password or -p option on the command line, mysqladmin prompts for
392 one.
393
394 Specifying a password on the command line should be considered
395 insecure. See Section 6.1.2.1, “End-User Guidelines for Password
396 Security”. You can use an option file to avoid giving the password
397 on the command line.
398
399 · --pipe, -W
400
401 On Windows, connect to the server using a named pipe. This option
402 applies only if the server supports named-pipe connections.
403
404 · --plugin-dir=dir_name
405
406 The directory in which to look for plugins. Specify this option if
407 the --default-auth option is used to specify an authentication
408 plugin but mysqladmin does not find it. See Section 6.3.10,
409 “Pluggable Authentication”.
410
411 · --port=port_num, -P port_num
412
413 The TCP/IP port number to use for the connection.
414
415 · --print-defaults
416
417 Print the program name and all options that it gets from option
418 files.
419
420 For additional information about this and other option-file
421 options, see Section 4.2.8, “Command-Line Options that Affect
422 Option-File Handling”.
423
424 · --protocol={TCP|SOCKET|PIPE|MEMORY}
425
426 The connection protocol to use for connecting to the server. It is
427 useful when the other connection parameters normally would cause a
428 protocol to be used other than the one you want. For details on the
429 permissible values, see Section 4.2.2, “Connecting to the MySQL
430 Server”.
431
432 · --relative, -r
433
434 Show the difference between the current and previous values when
435 used with the --sleep option. This option works only with the
436 extended-status command.
437
438 · --secure-auth
439
440 This option was removed in MySQL 8.0.3.
441
442 · --server-public-key-path=file_name
443
444 The path name to a file containing a client-side copy of the public
445 key required by the server for RSA key pair-based password
446 exchange. The file must be in PEM format. This option applies to
447 clients that authenticate with the sha256_password or
448 caching_sha2_password authentication plugin. This option is ignored
449 for accounts that do not authenticate with one of those plugins. It
450 is also ignored if RSA-based password exchange is not used, as is
451 the case when the client connects to the server using a secure
452 connection.
453
454 If --server-public-key-path=file_name is given and specifies a
455 valid public key file, it takes precedence over
456 --get-server-public-key.
457
458 For sha256_password, this option applies only if MySQL was built
459 using OpenSSL.
460
461 For information about the sha256_password and caching_sha2_password
462 plugins, see Section 6.5.1.2, “SHA-256 Pluggable Authentication”,
463 and Section 6.5.1.3, “Caching SHA-2 Pluggable Authentication”.
464
465 · --shared-memory-base-name=name
466
467 On Windows, the shared-memory name to use, for connections made
468 using shared memory to a local server. The default value is MYSQL.
469 The shared-memory name is case-sensitive.
470
471 The server must be started with the --shared-memory option to
472 enable shared-memory connections.
473
474 · --show-warnings
475
476 Show warnings resulting from execution of statements sent to the
477 server.
478
479 · --silent, -s
480
481 Exit silently if a connection to the server cannot be established.
482
483 · --sleep=delay, -i delay
484
485 Execute commands repeatedly, sleeping for delay seconds in between.
486 The --count option determines the number of iterations. If --count
487 is not given, mysqladmin executes commands indefinitely until
488 interrupted.
489
490 · --socket=path, -S path
491
492 For connections to localhost, the Unix socket file to use, or, on
493 Windows, the name of the named pipe to use.
494
495 · --ssl*
496
497 Options that begin with --ssl specify whether to connect to the
498 server using SSL and indicate where to find SSL keys and
499 certificates. See Section 6.4.2, “Command Options for Encrypted
500 Connections”.
501
502 · --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
503 mode on the client side. The --ssl-fips-mode option differs from
504 other --ssl-xxx options in that it is not used to establish
505 encrypted connections, but rather to affect which cryptographic
506 operations are permitted. See Section 6.6, “FIPS Support”.
507
508 These --ssl-fips-mode values are permitted:
509
510 · OFF: Disable FIPS mode.
511
512 · ON: Enable FIPS mode.
513
514 · STRICT: Enable “strict” FIPS mode.
515
516
517 Note
518 If the OpenSSL FIPS Object Module is not available, the only
519 permitted value for --ssl-fips-mode is OFF. In this case,
520 setting --ssl-fips-mode to ON or STRICT causes the client to
521 produce a warning at startup and to operate in non-FIPS mode.
522
523 · --tls-ciphersuites=ciphersuite_list
524
525 For client programs, specifies which TLSv1.3 ciphersuites the
526 client permits for encrypted connections. The value is a list of
527 one or more colon-separated ciphersuite names. The ciphersuites
528 that can be named for this option depend on the SSL library used to
529 compile MySQL. For details, see Section 6.4.6, “Encrypted
530 Connection Protocols and Ciphers”.
531
532 This option was added in MySQL 8.0.16.
533
534 · --tls-version=protocol_list
535
536 The protocols the client permits for encrypted connections. The
537 value is a list of one or more comma-separated protocol names. The
538 protocols that can be named for this option depend on the SSL
539 library used to compile MySQL. For details, see Section 6.4.6,
540 “Encrypted Connection Protocols and Ciphers”.
541
542 · --user=user_name, -u user_name
543
544 The MySQL user name to use when connecting to the server.
545
546 · --verbose, -v
547
548 Verbose mode. Print more information about what the program does.
549
550 · --version, -V
551
552 Display version information and exit.
553
554 · --vertical, -E
555
556 Print output vertically. This is similar to --relative, but prints
557 output vertically.
558
559 · --wait[=count], -w[count]
560
561 If the connection cannot be established, wait and retry instead of
562 aborting. If a count value is given, it indicates the number of
563 times to retry. The default is one time.
564
565 You can also set the following variables by using --var_name=value.
566
567 · connect_timeout
568
569 The maximum number of seconds before connection timeout. The
570 default value is 43200 (12 hours).
571
572 · shutdown_timeout
573
574 The maximum number of seconds to wait for server shutdown. The
575 default value is 3600 (1 hour).
576
578 Copyright © 1997, 2019, Oracle and/or its affiliates. All rights
579 reserved.
580
581 This documentation is free software; you can redistribute it and/or
582 modify it only under the terms of the GNU General Public License as
583 published by the Free Software Foundation; version 2 of the License.
584
585 This documentation is distributed in the hope that it will be useful,
586 but WITHOUT ANY WARRANTY; without even the implied warranty of
587 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
588 General Public License for more details.
589
590 You should have received a copy of the GNU General Public License along
591 with the program; if not, write to the Free Software Foundation, Inc.,
592 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
593 http://www.gnu.org/licenses/.
594
595
597 For more information, please refer to the MySQL Reference Manual, which
598 may already be installed locally and which is also available online at
599 http://dev.mysql.com/doc/.
600
602 Oracle Corporation (http://dev.mysql.com/).
603
604
605
606MySQL 8.0 02/20/2019 MYSQLADMIN(1)