1MYSQLADMIN(1) MySQL Database System MYSQLADMIN(1)
2
3
4
6 mysqladmin - client for administering a MySQL server
7
9 mysqladmin [options] command [command-arg] [command [command-arg]] ...
10
12 mysqladmin is a client for performing administrative operations. You
13 can use it to check the server´s configuration and current status, to
14 create and drop databases, and more.
15
16 Invoke mysqladmin like this:
17
18 shell> mysqladmin [options] command [command-arg] [command [command-arg]] ...
19
20 mysqladmin supports the following commands. Some of the commands take
21 an argument following the command name.
22
23 · create db_name
24
25 Create a new database named db_name.
26
27 · debug
28
29 Tell the server to write debug information to the error log.
30
31 Beginning with MySQL 5.1.12, this includes information about the
32 Event Scheduler. See Section 19.4.5, “Event Scheduler Status”.
33
34 · drop db_name
35
36 Delete the database named db_name and all its tables.
37
38 · extended-status
39
40 Display the server status variables and their values.
41
42 · flush-hosts
43
44 Flush all information in the host cache.
45
46 · flush-logs
47
48 Flush all logs.
49
50 · flush-privileges
51
52 Reload the grant tables (same as reload).
53
54 · flush-status
55
56 Clear status variables.
57
58 · flush-tables
59
60 Flush all tables.
61
62 · flush-threads
63
64 Flush the thread cache.
65
66 · kill id,id,...
67
68 Kill server threads. If multiple thread ID values are given, there
69 must be no spaces in the list.
70
71 · old-password new-password
72
73 This is like the password command but stores the password using the
74 old (pre-4.1) password-hashing format. (See Section 5.3.2.3,
75 “Password Hashing in MySQL”.)
76
77 · password new-password
78
79 Set a new password. This changes the password to new-password for
80 the account that you use with mysqladmin for connecting to the
81 server. Thus, the next time you invoke mysqladmin (or any other
82 client program) using the same account, you will need to specify
83 the new password.
84
85 If the new-password value contains spaces or other characters that
86 are special to your command interpreter, you need to enclose it
87 within quotes. On Windows, be sure to use double quotes rather than
88 single quotes; single quotes are not stripped from the password,
89 but rather are interpreted as part of the password. For example:
90
91 shell> mysqladmin password "my new password"
92
93 Caution
94 Do not use this command used if the server was started with the
95 --skip-grant-tables option. No password change will be applied.
96 This is true even if you precede the password command with
97 flush-privileges on the same command line to re-enable the
98 grant tables because the flush operation occurs after you
99 connect. However, you can use mysqladmin flush-privileges to
100 re-enable the grant table and then use a separate mysqladmin
101 password command to change the password.
102
103 · ping
104
105 Check whether the server is alive. The return status from
106 mysqladmin is 0 if the server is running, 1 if it is not. This is 0
107 even in case of an error such as Access denied, because this means
108 that the server is running but refused the connection, which is
109 different from the server not running.
110
111 · processlist
112
113 Show a list of active server threads. This is like the output of
114 the SHOW PROCESSLIST statement. If the --verbose option is given,
115 the output is like that of SHOW FULL PROCESSLIST. (See
116 Section 12.4.5.31, “SHOW PROCESSLIST Syntax”.)
117
118 · reload
119
120 Reload the grant tables.
121
122 · refresh
123
124 Flush all tables and close and open log files.
125
126 · shutdown
127
128 Stop the server.
129
130 · start-slave
131
132 Start replication on a slave server.
133
134 · status
135
136 Display a short server status message.
137
138 · stop-slave
139
140 Stop replication on a slave server.
141
142 · variables
143
144 Display the server system variables and their values.
145
146 · version
147
148 Display version information from the server.
149
150 All commands can be shortened to any unique prefix. For example:
151
152 shell> mysqladmin proc stat
153 +----+-------+-----------+----+---------+------+-------+------------------+
154 | Id | User | Host | db | Command | Time | State | Info |
155 +----+-------+-----------+----+---------+------+-------+------------------+
156 | 51 | monty | localhost | | Query | 0 | | show processlist |
157 +----+-------+-----------+----+---------+------+-------+------------------+
158 Uptime: 1473624 Threads: 1 Questions: 39487
159 Slow queries: 0 Opens: 541 Flush tables: 1
160 Open tables: 19 Queries per second avg: 0.0268
161
162
163 The mysqladmin status command result displays the following values:
164
165 · Uptime
166
167 The number of seconds the MySQL server has been running.
168
169 · Threads
170
171 The number of active threads (clients).
172
173 · Questions
174
175 The number of questions (queries) from clients since the server was
176 started.
177
178 · Slow queries
179
180 The number of queries that have taken more than long_query_time
181 seconds. See Section 5.2.5, “The Slow Query Log”.
182
183 · Opens
184
185 The number of tables the server has opened.
186
187 · Flush tables
188
189 The number of flush-*, refresh, and reload commands the server has
190 executed.
191
192 · Open tables
193
194 The number of tables that currently are open.
195
196 · Memory in use
197
198 The amount of memory allocated directly by mysqld. This value is
199 displayed only when MySQL has been compiled with --with-debug=full.
200
201 · Maximum memory used
202
203 The maximum amount of memory allocated directly by mysqld. This
204 value is displayed only when MySQL has been compiled with
205 --with-debug=full.
206
207 If you execute mysqladmin shutdown when connecting to a local server
208 using a Unix socket file, mysqladmin waits until the server´s process
209 ID file has been removed, to ensure that the server has stopped
210 properly.
211
212 mysqladmin supports the following options, which can be specified on
213 the command line or in the [mysqladmin] and [client] option file
214 groups. mysqladmin also supports the options for processing option
215 files described at Section 4.2.3.3.1, “Command-Line Options that Affect
216 Option-File Handling”.
217
218 · --help, -?
219
220 Display a help message and exit.
221
222 · --character-sets-dir=path
223
224 The directory where character sets are installed. See Section 9.5,
225 “Character Set Configuration”.
226
227 · --compress, -C
228
229 Compress all information sent between the client and the server if
230 both support compression.
231
232 · --connect-timeout=timeout
233
234 Equivalent to --connect_timeout, see the end of this section.
235
236 · --count=N, -c N
237
238 The number of iterations to make for repeated command execution if
239 the --sleep option is given.
240
241 · --debug[=debug_options], -# [debug_options]
242
243 Write a debugging log. A typical debug_options string is
244 ´d:t:o,file_name´. The default is ´d:t:o,/tmp/mysqladmin.trace´.
245
246 · --debug-check
247
248 Print some debugging information when the program exits. This
249 option was added in MySQL 5.1.21.
250
251 · --debug-info
252
253 Print debugging information and memory and CPU usage statistics
254 when the program exits. This option was added in MySQL 5.1.14.
255
256 · --default-character-set=charset_name
257
258 Use charset_name as the default character set. See Section 9.5,
259 “Character Set Configuration”.
260
261 · --defaults-extra-file=filename
262
263 Set filename as the file to read default options from after the
264 global defaults files has been read. Must be given as first
265 option.
266
267 · --defaults-file=filename
268
269 Set filename as the file to read default options from, override
270 global defaults files. Must be given as first option.
271
272 · --force, -f
273
274 Do not ask for confirmation for the drop db_name command. With
275 multiple commands, continue even if an error occurs.
276
277 · --host=host_name, -h host_name
278
279 Connect to the MySQL server on the given host.
280
281 · --no-beep, -b
282
283 Suppress the warning beep that is emitted by default for errors
284 such as a failure to connect to the server. This option was added
285 in MySQL 5.1.17.
286
287 · --no-defaults
288
289 Do not read default options from any option file. This must be
290 given as the first argument.
291
292 · --password[=password], -p[password]
293
294 The password to use when connecting to the server. If you use the
295 short option form (-p), you cannot have a space between the option
296 and the password. If you omit the password value following the
297 --password or -p option on the command line, mysqladmin prompts for
298 one.
299
300 Specifying a password on the command line should be considered
301 insecure. See Section 5.3.2.2, “End-User Guidelines for Password
302 Security”. You can use an option file to avoid giving the password
303 on the command line.
304
305 · --pipe, -W
306
307 On Windows, connect to the server via a named pipe. This option
308 applies only if the server supports named-pipe connections.
309
310 · --port=port_num, -P port_num
311
312 The TCP/IP port number to use for the connection.
313
314 · --print-defaults
315
316 Print the program argument list and exit. This must be given as the
317 first argument.
318
319 · --protocol={TCP|SOCKET|PIPE|MEMORY}
320
321 The connection protocol to use for connecting to the server. It is
322 useful when the other connection parameters normally would cause a
323 protocol to be used other than the one you want. For details on the
324 allowable values, see Section 4.2.2, “Connecting to the MySQL
325 Server”.
326
327 · --relative, -r
328
329 Show the difference between the current and previous values when
330 used with the --sleep option. Currently, this option works only
331 with the extended-status command.
332
333 · --shutdown-timeouttimeout
334
335 Equivalent of --shutdown_timeout, see the end of this section.
336
337 · --silent, -s
338
339 Exit silently if a connection to the server cannot be established.
340
341 · --sleep=delay, -i delay
342
343 Execute commands repeatedly, sleeping for delay seconds in between.
344 The --count option determines the number of iterations. If --count
345 is not given, mysqladmin executes commands indefinitely until
346 interrupted.
347
348 · --socket=path, -S path
349
350 For connections to localhost, the Unix socket file to use, or, on
351 Windows, the name of the named pipe to use.
352
353 · --ssl*
354
355 Options that begin with --ssl specify whether to connect to the
356 server via SSL and indicate where to find SSL keys and
357 certificates. See Section 5.5.6.3, “SSL Command Options”.
358
359 · --user=user_name, -u user_name
360
361 The MySQL user name to use when connecting to the server.
362
363 · --verbose, -v
364
365 Verbose mode. Print more information about what the program does.
366
367 · --version, -V
368
369 Display version information and exit.
370
371 · --vertical, -E
372
373 Print output vertically. This is similar to --relative, but prints
374 output vertically.
375
376 · --wait[=count], -w[count]
377
378 If the connection cannot be established, wait and retry instead of
379 aborting. If a count value is given, it indicates the number of
380 times to retry. The default is one time.
381
382 You can also set the following variables by using --var_name=value The
383 --set-variable format is deprecated and is removed in MySQL 5.5.
384 syntax:
385
386 · connect_timeout
387
388 The maximum number of seconds before connection timeout. The
389 default value is 43200 (12 hours).
390
391 · shutdown_timeout
392
393 The maximum number of seconds to wait for server shutdown. The
394 default value is 3600 (1 hour).
395
397 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
398
399 This documentation is free software; you can redistribute it and/or
400 modify it only under the terms of the GNU General Public License as
401 published by the Free Software Foundation; version 2 of the License.
402
403 This documentation is distributed in the hope that it will be useful,
404 but WITHOUT ANY WARRANTY; without even the implied warranty of
405 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
406 General Public License for more details.
407
408 You should have received a copy of the GNU General Public License along
409 with the program; if not, write to the Free Software Foundation, Inc.,
410 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
411 http://www.gnu.org/licenses/.
412
413
415 For more information, please refer to the MySQL Reference Manual, which
416 may already be installed locally and which is also available online at
417 http://dev.mysql.com/doc/.
418
420 Sun Microsystems, Inc. (http://www.mysql.com/).
421
422
423
424MySQL 5.1 04/06/2010 MYSQLADMIN(1)