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 commands described in the following list. Some
23 of the commands take 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.
32
33 · drop db_name
34
35 Delete the database named db_name and all its tables.
36
37 · extended-status
38
39 Display the server status variables and their values.
40
41 MySQL Enterprise. For expert advice on using server status variables,
42 subscribe to the MySQL Network Monitoring and Advisory Service. For
43 more information see
44 http://www.mysql.com/products/enterprise/advisors.html.
45
46 · flush-hosts
47
48 Flush all information in the host cache.
49
50 · flush-logs
51
52 Flush all logs.
53
54 · flush-privileges
55
56 Reload the grant tables (same as reload).
57
58 · flush-status
59
60 Clear status variables.
61
62 · flush-tables
63
64 Flush all tables.
65
66 · flush-threads
67
68 Flush the thread cache.
69
70 · kill id,id,...
71
72 Kill server threads. If multiple thread ID values are given, there
73 must be no spaces in the list.
74
75 · old-password new-password
76
77 This is like the password command but stores the password using the
78 old (pre-4.1) password-hashing format. (See Section 5.9, “Password
79 Hashing as of MySQL 4.1”.)
80
81 MySQL Enterprise. For expert advice on the security implications of
82 using the old-password command, subscribe to the MySQL Network
83 Monitoring and Advisory Service. For more information see
84 http://www.mysql.com/products/enterprise/advisors.html.
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 the
92 new password.
93
94 If the new-password value contains spaces or other characters that
95 are special to your command interpreter, you need to enclose it
96 within quotes. On Windows, be sure to use double quotes rather than
97 single quotes; single quotes are not stripped from the password, but
98 rather are interpreted as part of the password. For example:
99
100 shell> mysqladmin password "my new password"
101
102 · ping
103
104 Check whether the server is alive. The return status from mysqladmin
105 is 0 if the server is running, 1 if it is not. This is 0 even in
106 case of an error such as Access denied, because this means that the
107 server is running but refused the connection, which is different
108 from the server not running.
109
110 · processlist
111
112 Show a list of active server threads. This is like the output of the
113 SHOW PROCESSLIST statement. If the --verbose option is given, the
114 output is like that of SHOW FULL PROCESSLIST. (See Section 5.4.21,
115 “SHOW PROCESSLIST Syntax”.)
116
117 · reload
118
119 Reload the grant tables.
120
121 · refresh
122
123 Flush all tables and close and open log files.
124
125 · shutdown
126
127 Stop the server.
128
129 · start-slave
130
131 Start replication on a slave server.
132
133 · status
134
135 Display a short server status message.
136
137 · stop-slave
138
139 Stop replication on a slave server.
140
141 · variables
142
143 Display the server system variables and their values.
144
145 MySQL Enterprise. For expert advice on using server system variables,
146 subscribe to the MySQL Network Monitoring and Advisory Service. For
147 more information see
148 http://www.mysql.com/products/enterprise/advisors.html.
149
150 · version
151
152 Display version information from the server.
153
154
155 All commands can be shortened to any unique prefix. For example:
156
157 shell> mysqladmin proc stat
158 +----+-------+-----------+----+---------+------+-------+------------------+
159 | Id | User | Host | db | Command | Time | State | Info |
160 +----+-------+-----------+----+---------+------+-------+------------------+
161 | 51 | monty | localhost | | Query | 0 | | show processlist |
162 +----+-------+-----------+----+---------+------+-------+------------------+
163 Uptime: 1473624 Threads: 1 Questions: 39487
164 Slow queries: 0 Opens: 541 Flush tables: 1
165 Open tables: 19 Queries per second avg: 0.0268
166
167 The mysqladmin status command result displays the following values:
168
169 · Uptime
170
171 The number of seconds the MySQL server has been running.
172
173 · Threads
174
175 The number of active threads (clients).
176
177 · Questions
178
179 The number of questions (queries) from clients since the server was
180 started.
181
182 · Slow queries
183
184 The number of queries that have taken more than long_query_time
185 seconds. See Section 9.4, “The Slow Query Log”.
186
187 · Opens
188
189 The number of tables the server has opened.
190
191 · Flush tables
192
193 The number of flush-*, refresh, and reload commands the server has
194 executed.
195
196 · Open tables
197
198 The number of tables that currently are open.
199
200 · Memory in use
201
202 The amount of memory allocated directly by mysqld. This value is
203 displayed only when MySQL has been compiled with --with-debug=full.
204
205 · Maximum memory used
206
207 The maximum amount of memory allocated directly by mysqld. This
208 value is displayed only when MySQL has been compiled with
209 --with-debug=full.
210
211
212 If you execute mysqladmin shutdown when connecting to a local server
213 using a Unix socket file, mysqladmin waits until the server's process
214 ID file has been removed, to ensure that the server has stopped
215 properly.
216
217 mysqladmin supports the following options:
218
219 · --help, -?
220
221 Display a help message and exit.
222
223 · --character-sets-dir=path
224
225 The directory where character sets are installed. See Section 8.1,
226 “The Character Set Used for Data and Sorting”.
227
228 · --compress, -C
229
230 Compress all information sent between the client and the server if
231 both support compression.
232
233 · --count=N, -c N
234
235 The number of iterations to make for repeated command execution.
236 This works only with the --sleep option.
237
238 · --debug[=debug_options], -# [debug_options]
239
240 Write a debugging log. The debug_options string often is
241 ´d:t:o,file_name'. The default is ´d:t:o,/tmp/mysqladmin.trace'.
242
243 · --default-character-set=charset_name
244
245 Use charset_name as the default character set. See Section 8.1, “The
246 Character Set Used for Data and Sorting”.
247
248 · --force, -f
249
250 Do not ask for confirmation for the drop db_name command. With
251 multiple commands, continue even if an error occurs.
252
253 · --host=host_name, -h host_name
254
255 Connect to the MySQL server on the given host.
256
257 · --password[=password], -p[password]
258
259 The password to use when connecting to the server. If you use the
260 short option form (-p), you cannot have a space between the option
261 and the password. If you omit the password value following the
262 --password or -p option on the command line, you are prompted for
263 one.
264
265 Specifying a password on the command line should be considered
266 insecure. See Section 6.6, “Keeping Your Password Secure”.
267
268 · --port=port_num, -P port_num
269
270 The TCP/IP port number to use for the connection.
271
272 · --protocol={TCP|SOCKET|PIPE|MEMORY}
273
274 The connection protocol to use.
275
276 · --relative, -r
277
278 Show the difference between the current and previous values when
279 used with the --sleep option. Currently, this option works only with
280 the extended-status command.
281
282 · --silent, -s
283
284 Exit silently if a connection to the server cannot be established.
285
286 · --sleep=delay, -i delay
287
288 Execute commands repeatedly, sleeping for delay seconds in between.
289 The --count option determines the number of iterations.
290
291 · --socket=path, -S path
292
293 For connections to localhost, the Unix socket file to use, or, on
294 Windows, the name of the named pipe to use.
295
296 · --ssl*
297
298 Options that begin with --ssl specify whether to connect to the
299 server via SSL and indicate where to find SSL keys and certificates.
300 See Section 6.7.3, “SSL Command Options”.
301
302 · --user=user_name, -u user_name
303
304 The MySQL username to use when connecting to the server.
305
306 · --verbose, -v
307
308 Verbose mode. Print more information about what the program does.
309
310 · --version, -V
311
312 Display version information and exit.
313
314 · --vertical, -E
315
316 Print output vertically. This is similar to --relative, but prints
317 output vertically.
318
319 · --wait[=count], -w[count]
320
321 If the connection cannot be established, wait and retry instead of
322 aborting. If a count value is given, it indicates the number of
323 times to retry. The default is one time.
324
325
326 You can also set the following variables by using --var_name=value
327 syntax:
328
329 · connect_timeout
330
331 The maximum number of seconds before connection timeout. The default
332 value is 43200 (12 hours).
333
334 · shutdown_timeout
335
336 The maximum number of seconds to wait for server shutdown. The
337 default value is 3600 (1 hour).
338
339
340 It is also possible to set variables by using
341 --set-variable=var_name=value or -O var_name=value syntax. This syntax
342 is deprecated.
343
345 Copyright 1997-2007 MySQL AB
346
347 This documentation is NOT distributed under a GPL license. Use of this
348 documentation is subject to the following terms: You may create a
349 printed copy of this documentation solely for your own personal use.
350 Conversion to other formats is allowed as long as the actual content is
351 not altered or edited in any way. You shall not publish or distribute
352 this documentation in any form or on any media, except if you
353 distribute the documentation in a manner similar to how MySQL
354 disseminates it (that is, electronically for download on a Web site
355 with the software) or on a CD-ROM or similar medium, provided however
356 that the documentation is disseminated together with the software on
357 the same medium. Any other use, such as any dissemination of printed
358 copies or use of this documentation, in whole or in part, in another
359 publication, requires the prior written consent from an authorized
360 representative of MySQL AB. MySQL AB reserves any and all rights to
361 this documentation not expressly granted above.
362
363 Please email <docs@mysql.com> for more information.
364
366 For more information, please refer to the MySQL Reference Manual, which
367 may already be installed locally and which is also available online at
368 http://dev.mysql.com/doc/.
369
371 MySQL AB (http://www.mysql.com/). This software comes with no
372 warranty.
373
374
375
376MySQL 5.0 07/04/2007 MYSQLADMIN(1)