File: mysqluc.1

package info (click to toggle)
mysql-utilities 1.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,100 kB
  • ctags: 1,681
  • sloc: python: 19,938; makefile: 34
file content (315 lines) | stat: -rw-r--r-- 12,538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
'\" t
.\"     Title: \fBmysqluc\fR
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\"      Date: 08/30/2013
.\"    Manual: MySQL Utilities
.\"    Source: MySQL 1.3.4
.\"  Language: English
.\"
.TH "\FBMYSQLUC\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysqluc
.\" utilities: mysqluc
.\" scripts
.SH "NAME"
mysqluc \- Command line client for running MySQL Utilities
.SH "SYNOPSIS"
.\".HP \w'\fBmysqluc\ [\-\-help\ |\ \-\-version\ |\ [\ |\ \-\-verbose\ |\ \-\-quiet\ |]\ \-\-width=<num>\ |\ \-\-utildir=<path>\ |\ \-\-execute\ <command\ list>\ <variable>=<value>]\fR\ 'u
\fBmysqluc [\-\-help | \-\-version | [ | \-\-verbose | \-\-quiet |] \-\-width=<num> | \-\-utildir=<path> | \-\-execute <command list> <variable>=<value>]\fR
.SH "DESCRIPTION"
.PP
This utility provides a command line environment for running MySQL Utilities\&.
.PP
The mysqluc utility, hence console, allows users to execute any of the currently installed MySQL Utilities command\&. The option
\fB\-\-utildir\fR
is used to provide a path to the MySQL Utilities if the location is different from when the utility is executed\&.
.PP
The console has a list of console or base commands\&. These allow the user to interact with the features of the console itself\&. The list of base commands is shown below along with a brief description\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
Command                 Description
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-  \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
help utilities          Display list of all utilities supported\&.
help <utility>          Display help for a specific utility\&.
help | help commands    Show this list\&.
exit | quit             Exit the console\&.
set <variable>=<value>  Store a variable for recall in commands\&.
show options            Display list of options specified by the user on
                        launch\&.
show variables          Display list of variables\&.
<ENTER>                 Press ENTER to execute command\&.
<ESCAPE>                Press ESCAPE to clear the command entry\&.
<DOWN>                  Press DOWN to retrieve the previous command\&.
<UP>                    Press UP to retrieve the next command in history\&.
<TAB>                   Press TAB for type completion of utility, option,
                        or variable names\&.
<TAB><TAB>              Press TAB twice for list of matching type
                        completion (context sensitive)\&.
.fi
.if n \{\
.RE
.\}
.PP
One of the most helpful base commands is the ability to see the options for a given utility by typing \*(Aqhelp <utility>\*(Aq\&. When the user types this command and presses ENTER, the console will display a list of all of the options for the utility\&.
.PP
The console provides tab completion for all commands, options for utilities, and user\-defined variables\&. Tab completion for commands allows users to specify the starting N characters of a command and press TAB to complete the command\&. If there are more than one command that matches the prefix, and the user presses TAB twice, a list of all possible matches is displayed\&.
.PP
Tab completion for options is similar\&. The user must first type a valid MySQL Utility command then types the first N characters of a command and presses TAB, for example \(en\-verb<TAB>\&. In this case, the console will complete the option\&. For the cases where an option requires a value, the console will complete the option name and append the \*(Aq=\*(Aq character\&. Tab completion for options works for both the full name and the alias (if available)\&. If the user presses TAB twice, the console will display a list of matching options\&. Pressing TAB twice immediately after typing the name of a MySQL Utility will display a list of all options for that utility\&.
.PP
Tab completion for variables works the same as that for options\&. In this case, the user must first type the \*(Aq$\*(Aq character then press TAB\&. For example, if a variable $SERVER1 exists, when the user types \(en\-server=$SER<TAB>, the console will complete the $SERVER variable name\&. For cases where there are multiple variables, pressing TAB twice will display a list of all matches to the first $+N characters\&. Pressing TAB twice after typing only the $ character will display a list of all variables\&.
.PP
Note: the console does not require typing the \*(Aqmysql\*(Aq prefix for the utility\&. For example, if the user types \*(Aqdisku<TAB>\*(Aq the console will complete the command with \*(Aqdiskusage \*(Aq\&.
.PP
Executing utilities is accomplished by typing the complete command and pressing ENTER\&. The user does not have to type \*(Aqpython\*(Aq or provide the \*(Aq\&.py\*(Aq file extension\&. The console will add these if needed\&.
.PP
The user can also run commands using the option
\fB\-\-execute\fR\&. The value for this option is a semi\-colon separated list of commands to execute\&. These can be base commands or MySQL Utility commands\&. The console will execute each command and display the output\&. All commands to be run by the console must appear inside a quoted string and separated by semi\-colons\&. Commands outside of the quoted string will be treated as arguments for the mysqluc utility itself and thus ignored for execution\&.
.PP
Note: if there is an error in the console or related code, the console will stop executing commands at the point of failure\&. Commands may also be piped into the console using a mechanism like \*(Aqecho \(lq<commands>\(rq | mysqluc\(rq\&.
.PP
The console also allows users to set user\-defined variables for commonly used values in options\&. The syntax is simply \*(Aqset VARNAME=VALUE\*(Aq\&. The user can see a list of all variables by entering the \*(Aqshow variables\*(Aq command\&. To use the values of these variables in utility commands, the user must prefix the value with a \*(Aq$\*(Aq\&. For example, \-\-server=$SERVER1 will substitute the value of the SERVER1 user\-defined variable when the utility is executed\&.
.PP
Note: user\-defined variables have a session lifetime\&. They are not saved from one execution to another of the users console\&.
.PP
User\-defined variables may also be set by passing them as arguments to the mysqluc command\&. For example, to set the SERVER1 variable and launch the console, the user can launch the console using this command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqluc SERVER1=root@localhost
.fi
.if n \{\
.RE
.\}
.PP
The user can provide any number of user\-defined variables but they must contain a value and no spaces around the \*(Aq=\*(Aq character\&. Once the console is launched, the user can see all variables using the \*(Aqshow variables\*(Aq command\&.
      OPTIONS
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
show program\*(Aqs version number and exit
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
show the program\*(Aqs help page
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
control how much information is displayed\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-quiet
.sp
suppress all informational messages
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-execute <commands>, \-e <commands>
.sp
Execute commands and exit\&. Multiple commands are separated with semi\-colons\&. Note: some platforms may require double quotes around command list\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-utildir <path>
.sp
location of utilities
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-width <number>
.sp
Display width
.RE
      NOTES
.PP
Using the
\fB\-\-execute\fR
option or piping commands to the console may require quotes or double quotes (for example, on Windows)\&.
      EXAMPLES
.PP
To launch the console, use this command:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqluc
.fi
.if n \{\
.RE
.\}
.PP
The following demonstrates launching the console and running the console command \*(Aqhelp utilities\*(Aq to see a list of all utilities supported\&. The console will execute the command then exit\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqluc \-e "help utilities"
Utility           Description
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-  \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
mysqlindexcheck   check for duplicate or redundant indexes
mysqlrplcheck     check replication
mysqluserclone    clone a MySQL user account to one or more new users
mysqldbcompare    compare databases for consistency
mysqldiff         compare object definitions among objects where the
                  difference is how db1\&.obj1 differs from db2\&.obj2
mysqldbcopy       copy databases from one server to another
mysqlreplicate    establish replication with a master
mysqldbexport     export metadata and data from databases
mysqldbimport     import metadata and data from files
mysqlmetagrep     search metadata
mysqlprocgrep     search process information
mysqldiskusage    show disk usage for databases
mysqlserverinfo   show server information
mysqlserverclone  start another instance of a running server
.fi
.if n \{\
.RE
.\}
.PP
The following demonstrates launching the console to run several commands using the \-\-execute option to including setting a variable for a server connection and executing a utility using variable substitution\&. Note: it may be necessary to escape the \*(Aq$\*(Aq on some platforms (for example, Linux)\&. Output below is an excerpt and is representational only\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqluc \-e "set SERVER=root@host123; mysqldiskusage \-\-server=\e$SERVER"
# Source on host123: \&.\&.\&. connected\&.
NOTICE: Your user account does not have read access to the datadir\&. Data
sizes will be calculated and actual file sizes may be omitted\&. Some features
may be unavailable\&.
# Database totals:
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| db_name            |       total  |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
\&.\&.\&.
| world              |           0  |
\&.\&.\&.
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
Total database disk usage = 1,072,359,052 bytes or 1022\&.00 MB
#\&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
The following demonstrates launching the console using the commands shown above but piped into the console on the command line\&. The results are the same as above\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ echo "set SERVER=root@host123; mysqldiskusage \-\-server=\e$SERVER" | mysqluc
.fi
.if n \{\
.RE
.\}
.PP
The following demonstrates launching the console and setting variables via the command line\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqluc SERVER=root@host123 VAR_A=57 \-e "show variables"
Variable  Value
\-\-\-\-\-\-\-\-  \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
SERVER    root@host123
VAR_A     57
.fi
.if n \{\
.RE
.\}
.SH "COPYRIGHT"
.br
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities section
of the MySQL Workbench Reference Manual, which is available online
at http://dev.mysql.com/doc/workbench/en/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).