1MYSQLUSERCLONE(1) MySQL Utilities MYSQLUSERCLONE(1)
2
3
4
6 mysqluserclone - Clone Existing User to Create New User
7
9 mysqluserclone [options] base_user new_user[:password][@host_name] ...
10
12 This utility uses an existing MySQL user account on one server as a
13 template, and clones it to create one or more new user accounts with
14 the same privileges as the original user. The new users can be created
15 on the original server or a different server.
16
17 To list users for a server, specify the --list option. This prints a
18 list of the users on the source (no destination is needed). To control
19 how to display list output, use one of the following values with the
20 --format option:
21
22 · grid (default)
23
24 Display output in grid or table format like that of the mysql
25 client command-line tool.
26
27 · csv
28
29 Display output in comma-separated values format.
30
31 · tab
32
33 Display output in tab-separated format.
34
35 · vertical
36
37 Display output in single-column format like that of the \G command
38 for the mysql client command-line tool.
39 OPTIONS.PP mysqluserclone accepts the following command-line options:
40
41 · --help
42
43 Display a help message and exit.
44
45 · --license
46
47 Display license information and exit.
48
49 · --destination=<destination>
50
51 Connection information for the destination server.
52
53 To connect to a server, it is necessary to specify connection
54 parameters such as user name, host name, password, and either a
55 port or socket. MySQL Utilities provides a number of ways to
56 provide this information. All of the methods require specifying
57 your choice via a command-line option such as --server, --master,
58 --slave, etc. The methods include the following in order of most
59 secure to least secure.
60
61 · Use login-paths from your .mylogin.cnf file (encrypted, not
62 visible). Example : <login-path>[:<port>][:<socket>]
63
64 · Use a configuration file (unencrypted, not visible) Note:
65 available in release-1.5.0. Example :
66 <configuration-file-path>[:<section>]
67
68 · Specify the data on the command-line (unencrypted, visible).
69 Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
70
71
72 · --dump, -d
73
74 Display the GRANT statements to create the account rather than
75 executing them. In this case, the utility does not connect to the
76 destination server and no --destination option is needed.
77
78 · --format=<list_format>, -f<list_format>
79
80 Specify the user display format. Permitted format values are grid,
81 csv, tab, and vertical. The default is grid. This option is valid
82 only if --list is given.
83
84 · --force
85
86 Drop the new user account if it exists before creating the new
87 account. Without this option, it is an error to try to create an
88 account that already exists.
89
90 · --include-global-privileges
91
92 Include privileges that match base_user@% as well as
93 base_user@host.
94
95 · --list
96
97 List all users on the source server. With this option, a
98 destination server need not be specified.
99
100 · --quiet, -q
101
102 Turn off all messages for quiet execution.
103
104 · --source=<source>
105
106 Connection information for the source server.
107
108 To connect to a server, it is necessary to specify connection
109 parameters such as user name, host name, password, and either a
110 port or socket. MySQL Utilities provides a number of ways to
111 provide this information. All of the methods require specifying
112 your choice via a command-line option such as --server, --master,
113 --slave, etc. The methods include the following in order of most
114 secure to least secure.
115
116 · Use login-paths from your .mylogin.cnf file (encrypted, not
117 visible). Example : <login-path>[:<port>][:<socket>]
118
119 · Use a configuration file (unencrypted, not visible) Note:
120 available in release-1.5.0. Example :
121 <configuration-file-path>[:<section>]
122
123 · Specify the data on the command-line (unencrypted, visible).
124 Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
125
126
127 · --ssl-ca
128
129 The path to a file that contains a list of trusted SSL CAs.
130
131 · --ssl-cert
132
133 The name of the SSL certificate file to use for establishing a
134 secure connection.
135
136 · --ssl-cert
137
138 The name of the SSL key file to use for establishing a secure
139 connection.
140
141 · --ssl
142
143 Specifies if the server connection requires use of SSL. If an
144 encrypted connection cannot be established, the connection attempt
145 fails. Default setting is 0 (SSL not required).
146
147 · --verbose, -v
148
149 Specify how much information to display. Use this option multiple
150 times to increase the amount of information. For example, -v =
151 verbose, -vv = more verbose, -vvv = debug.
152
153 · --version
154
155 Display version information and exit.
156 NOTES.PP You must provide connection parameters (user, host, password,
157 and so forth) for an account that has the appropriate privileges to
158 access all objects in the operation.
159
160 The account used to connect to the source server must have privileges
161 to read the mysql database.
162
163 The account used to connect to the destination server must have
164 privileges to execute CREATE USER (and DROP USER if the --force option
165 is given), and privileges to execute GRANT for all privileges to be
166 granted to the new accounts.
167
168 For the --format option, the permitted values are not case sensitive.
169 In addition, values may be specified as any unambiguous prefix of a
170 valid value. For example, --format=g specifies the grid format. An
171 error occurs if a prefix matches more than one valid value.
172
173 The path to the MySQL client tools should be included in the PATH
174 environment variable in order to use the authentication mechanism with
175 login-paths. This will allow the utility to use the my_print_defaults
176 tools which is required to read the login-path values from the login
177 configuration file (.mylogin.cnf). EXAMPLES.PP To clone joe as sam and
178 sally with passwords and logging in as root on the local machine, use
179 this command:
180
181 shell> mysqluserclone --source=root@localhost \
182 --destination=root@localhost \
183 joe@localhost sam:secret1@localhost sally:secret2@localhost
184 # Source on localhost: ... connected.
185 # Destination on localhost: ... connected.
186 # Cloning 2 users...
187 # Cloning joe@localhost to user sam:secret1@localhost
188 # Cloning joe@localhost to user sally:secret2@localhost
189 # ...done.
190
191 The following command shows all users on the local server in the most
192 verbose output in CSV format:
193
194 shell> mysqluserclone --source=root@localhost --list --format=csv -vvv
195 # Source on localhost: ... connected.
196 user,host,database
197 joe,localhost,util_test
198 rpl,localhost,
199 sally,localhost,util_test
200 sam,localhost,util_test
201 joe,user,util_test
202
203 PERMISSIONS REQUIRED.PP The permissions required include the ability to
204 read the mysql database and to have read access to the data directory.
205
207 Copyright © 2006, 2015, Oracle and/or its affiliates. All rights
208 reserved.
209
210 This documentation is free software; you can redistribute it and/or
211 modify it only under the terms of the GNU General Public License as
212 published by the Free Software Foundation; version 2 of the License.
213
214 This documentation is distributed in the hope that it will be useful,
215 but WITHOUT ANY WARRANTY; without even the implied warranty of
216 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
217 General Public License for more details.
218
219 You should have received a copy of the GNU General Public License along
220 with the program; if not, write to the Free Software Foundation, Inc.,
221 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
222 http://www.gnu.org/licenses/.
223
224
226 For more information, please refer to the MySQL Utilities and Fabric
227 documentation, which is available online at
228 http://dev.mysql.com/doc/index-utils-fabric.html
229
231 Oracle Corporation (http://dev.mysql.com/).
232
233
234
235MySQL 1.5.6 09/15/2015 MYSQLUSERCLONE(1)