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