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