1MYSQLUC(1) MySQL Utilities MYSQLUC(1)
2
3
4
6 mysqluc - Command line client for running MySQL Utilities
7
9 mysqluc [--help | --version | [ | --verbose | --quiet |] --width=<num>
10 |
11 --utildir=<path>
12 |
13 --execute
14 <command
15 list>
16 <variable>=<value>]
17
19 This utility provides a command line environment for running MySQL
20 Utilities.
21
22 The mysqluc utility, hence console, allows users to execute any of the
23 currently installed MySQL Utilities command. The option --utildir is
24 used to provide a path to the MySQL Utilities if the location is
25 different from when the utility is executed.
26
27 The console has a list of console or base commands. These allow the
28 user to interact with the features of the console itself. The list of
29 base commands is shown below along with a brief description.:
30
31 Command Description
32 ---------------------- ---------------------------------------------------
33 help utilities Display list of all utilities supported.
34 help <utility> Display help for a specific utility.
35 help | help commands Show this list.
36 exit | quit Exit the console.
37 set <variable>=<value> Store a variable for recall in commands.
38 show options Display list of options specified by the user on
39 launch.
40 show variables Display list of variables.
41 <ENTER> Press ENTER to execute command.
42 <ESCAPE> Press ESCAPE to clear the command entry.
43 <DOWN> Press DOWN to retrieve the previous command.
44 <UP> Press UP to retrieve the next command in history.
45 <TAB> Press TAB for type completion of utility, option,
46 or variable names.
47 <TAB><TAB> Press TAB twice for list of matching type
48 completion (context sensitive).
49
50 One of the most helpful base commands is the ability to see the options
51 for a given utility by typing 'help <utility>'. When the user types
52 this command and presses ENTER, the console will display a list of all
53 of the options for the utility.
54
55 The console provides tab completion for all commands, options for
56 utilities, and user-defined variables. Tab completion for commands
57 allows users to specify the starting N characters of a command and
58 press TAB to complete the command. If there are more than one command
59 that matches the prefix, and the user presses TAB twice, a list of all
60 possible matches is displayed.
61
62 Tab completion for options is similar. The user must first type a valid
63 MySQL Utility command then types the first N characters of a command
64 and presses TAB, for example –-verb<TAB>. In this case, the console
65 will complete the option. For the cases where an option requires a
66 value, the console will complete the option name and append the '='
67 character. Tab completion for options works for both the full name and
68 the alias (if available). If the user presses TAB twice, the console
69 will display a list of matching options. Pressing TAB twice immediately
70 after typing the name of a MySQL Utility will display a list of all
71 options for that utility.
72
73 Tab completion for variables works the same as that for options. In
74 this case, the user must first type the '$' character then press TAB.
75 For example, if a variable $SERVER1 exists, when the user types
76 –-server=$SER<TAB>, the console will complete the $SERVER variable
77 name. For cases where there are multiple variables, pressing TAB twice
78 will display a list of all matches to the first $+N characters.
79 Pressing TAB twice after typing only the $ character will display a
80 list of all variables.
81
82 Note
83 The 'mysql' prefix is optional in the console. For example, typing
84 'disku<TAB>' in the console will complete the command as 'diskusage
85 '.
86
87 Executing utilities is accomplished by typing the complete command and
88 pressing ENTER. The user does not have to type 'python' or provide the
89 '.py' file extension. The console will add these if needed.
90
91 The user can also run commands using the option --execute. The value
92 for this option is a semi-colon separated list of commands to execute.
93 These can be base commands or MySQL Utility commands. The console will
94 execute each command and display the output. All commands to be run by
95 the console must appear inside a quoted string and separated by
96 semi-colons. Commands outside of the quoted string will be treated as
97 arguments for the mysqluc utility itself and thus ignored for
98 execution.
99
100 Note
101 In the console, an error in the console or related code will stop
102 executing commands at the point of failure. Commands may also be
103 piped into the console using a mechanism such as 'echo "<commands>"
104 | mysqluc'.
105
106 The console also allows users to set user-defined variables for
107 commonly used values in options. The syntax is simply 'set
108 VARNAME=VALUE'. The user can see a list of all variables by entering
109 the 'show variables' command. To use the values of these variables in
110 utility commands, the user must prefix the value with a '$'. For
111 example, --server=$SERVER1 will substitute the value of the SERVER1
112 user-defined variable when the utility is executed.
113
114 Note
115 User-defined variables have a session lifetime. They are not saved
116 from one execution to another in the users console.
117
118 User-defined variables may also be set by passing them as arguments to
119 the mysqluc command. For example, to set the SERVER1 variable and
120 launch the console, the user can launch the console using this
121 command.:
122
123 shell> mysqluc SERVER1=root@localhost
124
125 The user can provide any number of user-defined variables but they must
126 contain a value and no spaces around the '=' character. Once the
127 console is launched, the user can see all variables using the 'show
128 variables' command. OPTIONS
129
130 · --version
131
132 show program's version number and exit
133
134 · --help
135
136 show the program's help page
137
138 · --license
139
140 Display license information and exit.
141
142 · --verbose, -v
143
144 control how much information is displayed. For example, -v =
145 verbose, -vv = more verbose, -vvv = debug
146
147 · --quiet
148
149 suppress all informational messages
150
151 · --execute <commands>, -e <commands>
152
153 Execute commands and exit. Multiple commands are separated with
154 semi-colons.
155
156 Note
157 Some platforms may require double quotes around the command
158 list.
159
160 · --utildir <path>
161
162 location of utilities
163
164 · --width <number>
165
166 Display width
167 NOTES.PP Using the --execute option or piping commands to the console
168 may require quotes or double quotes (for example, on Windows).
169 EXAMPLES.PP To launch the console, use this command:
170
171 shell> mysqluc
172
173 The following demonstrates launching the console and running the
174 console command 'help utilities' to see a list of all utilities
175 supported. The console will execute the command then exit.:
176
177 shell> mysqluc -e "help utilities"
178 Utility Description
179 ---------------- ---------------------------------------------------------
180 mysqlindexcheck check for duplicate or redundant indexes
181 mysqlrplcheck check replication
182 mysqluserclone clone a MySQL user account to one or more new users
183 mysqldbcompare compare databases for consistency
184 mysqldiff compare object definitions among objects where the
185 difference is how db1.obj1 differs from db2.obj2
186 mysqldbcopy copy databases from one server to another
187 mysqlreplicate establish replication with a master
188 mysqldbexport export metadata and data from databases
189 mysqldbimport import metadata and data from files
190 mysqlmetagrep search metadata
191 mysqlprocgrep search process information
192 mysqldiskusage show disk usage for databases
193 mysqlserverinfo show server information
194 mysqlserverclone start another instance of a running server
195
196 The following demonstrates launching the console to run several
197 commands using the --execute option to including setting a variable for
198 a server connection and executing a utility using variable
199 substitution.
200
201 Note
202 It may be necessary to escape the '$' on some platforms, such as
203 Linux.
204
205 The output below is an excerpt and is representational only:
206
207 shell> mysqluc -e "set SERVER=root@host123; mysqldiskusage --server=\$SERVER"
208 # Source on host123: ... connected.
209 NOTICE: Your user account does not have read access to the datadir. Data
210 sizes will be calculated and actual file sizes may be omitted. Some features
211 may be unavailable.
212 # Database totals:
213 +--------------------+--------------+
214 | db_name | total |
215 +--------------------+--------------+
216 ...
217 | world | 0 |
218 ...
219 +--------------------+--------------+
220 Total database disk usage = 1,072,359,052 bytes or 1022.00 MB
221 #...done.
222
223 The following demonstrates launching the console using the commands
224 shown above but piped into the console on the command line. The results
225 are the same as above.:
226
227 shell> echo "set SERVER=root@host123; mysqldiskusage --server=\$SERVER" | mysqluc
228
229 The following demonstrates launching the console and setting variables
230 via the command line.:
231
232 shell> mysqluc SERVER=root@host123 VAR_A=57 -e "show variables"
233 Variable Value
234 -------- -----------------------------------------------------------------
235 SERVER root@host123
236 VAR_A 57
237
238 PERMISSIONS REQUIRED.PP There are no special permissions required to
239 run mysqluc however, you must have the necessary privileges to execute
240 the desired utilities. See the PERMISSIONS REQUIRED section for each
241 command you wish to execute.
242
244 Copyright © 2006, 2015, Oracle and/or its affiliates. All rights
245 reserved.
246
247 This documentation is free software; you can redistribute it and/or
248 modify it only under the terms of the GNU General Public License as
249 published by the Free Software Foundation; version 2 of the License.
250
251 This documentation is distributed in the hope that it will be useful,
252 but WITHOUT ANY WARRANTY; without even the implied warranty of
253 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
254 General Public License for more details.
255
256 You should have received a copy of the GNU General Public License along
257 with the program; if not, write to the Free Software Foundation, Inc.,
258 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
259 http://www.gnu.org/licenses/.
260
261
263 For more information, please refer to the MySQL Utilities and Fabric
264 documentation, which is available online at
265 http://dev.mysql.com/doc/index-utils-fabric.html
266
268 Oracle Corporation (http://dev.mysql.com/).
269
270
271
272MySQL 1.5.6 09/15/2015 MYSQLUC(1)