'\" t .\" Title: \fBmysqluserclone\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 08/01/2016 .\" Manual: MySQL Utilities .\" Source: MySQL 1.6.3 .\" Language: English .\" .TH "\FBMYSQLUSERCLONE\FR" "1" "08/01/2016" "MySQL 1\&.6\&.3" "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 * .\" ----------------------------------------------------------------- .SH "NAME" mysqluserclone \- Clone Existing User to Create New User .SH "SYNOPSIS" .HP \w'\fBmysqluserclone\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIbase_user\fR\fR\fB\ \fR\fB\fInew_user\fR\fR\fB[\fR\fB\fI:password\fR\fR\fB][\fR\fB\fI@host_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u \fBmysqluserclone [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIbase_user\fR\fR\fB \fR\fB\fInew_user\fR\fR\fB[\fR\fB\fI:password\fR\fR\fB][\fR\fB\fI@host_name\fR\fR\fB] \&.\&.\&.\fR .SH "DESCRIPTION" .PP This utility uses an existing MySQL user account on one server as a template, and clones it to create one or more new user accounts with the same privileges as the original user\&. The new users can be created on the original server or a different server\&. .PP To list users for a server, specify the \fB\-\-list\fR option\&. This prints a list of the users on the source (no destination is needed)\&. To control how to display list output, use one of the following values with the \fB\-\-format\fR option: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBgrid\fR (default) .sp Display output in grid or table format like that of the \fBmysql\fR client command\-line tool\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBcsv\fR .sp Display output in comma\-separated values format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBtab\fR .sp Display output in tab\-separated format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBvertical\fR .sp Display output in single\-column format like that of the \eG command for the \fBmysql\fR client command\-line tool\&. .RE OPTIONS.PP \fBmysqluserclone\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-license .sp Display license information and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-destination= .sp Connection information for the destination server\&. .sp To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use login\-paths from your \&.mylogin\&.cnf file (encrypted, not visible)\&. Example : <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example : <\fIconfiguration\-file\-path\fR>[:<\fIsection\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Specify the data on the command\-line (unencrypted, visible)\&. Example : <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-dump, \-d .sp Display the \fBGRANT\fR statements to create the account rather than executing them\&. In this case, the utility does not connect to the destination server and no \fB\-\-destination\fR option is needed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-format=, \-f .sp Specify the user display format\&. Permitted format values are \fBgrid\fR, \fBcsv\fR, \fBtab\fR, and \fBvertical\fR\&. The default is \fBgrid\fR\&. This option is valid only if \fB\-\-list\fR is given\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-force .sp Drop the new user account if it exists before creating the new account\&. Without this option, it is an error to try to create an account that already exists\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-include\-global\-privileges .sp Include privileges that match base_user@% as well as base_user@host\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-list .sp List all users on the source server\&. With this option, a destination server need not be specified\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-quiet, \-q .sp Turn off all messages for quiet execution\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-source= .sp Connection information for the source server\&. .sp To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use login\-paths from your \&.mylogin\&.cnf file (encrypted, not visible)\&. Example : <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example : <\fIconfiguration\-file\-path\fR>[:<\fIsection\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Specify the data on the command\-line (unencrypted, visible)\&. Example : <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-ca .sp The path to a file that contains a list of trusted SSL CAs\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-cert .sp The name of the SSL certificate file to use for establishing a secure connection\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-cert .sp The name of the SSL key file to use for establishing a secure connection\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl .sp Specifies if the server connection requires use of SSL\&. If an encrypted connection cannot be established, the connection attempt fails\&. Default setting is 0 (SSL not required)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-verbose, \-v .sp Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. 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 .\} \-\-version .sp Display version information and exit\&. .RE NOTES.PP For the \fB\-\-format\fR option, the permitted values are not case sensitive\&. In addition, values may be specified as any unambiguous prefix of a valid value\&. For example, \fB\-\-format=g\fR specifies the grid format\&. An error occurs if a prefix matches more than one valid value\&. .PP The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the my_print_defaults tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&. .PP When cloning users that are defined with an authentication plugin, the utility will attempt to use the authentication plugin for the destination user(s)\&. The utility will issue an error if the plugin is not on the destination machine or is inactive and the operation will be aborted\&. A warning is issued if a password is assigned to a new user when the source user has an authentication plugin\&. In this case, the utility will use the password and not the authentication plugin for the new user\&. EXAMPLES.PP To clone joe as sam and sally with passwords and logging in as root on the local machine, use this command: .sp .if n \{\ .RS 4 .\} .nf shell> \fBmysqluserclone \-\-source=root@localhost \e\fR \fB\-\-destination=root@localhost \e\fR \fBjoe@localhost sam:secret1@localhost sally:secret2@localhost\fR # Source on localhost: \&.\&.\&. connected\&. # Destination on localhost: \&.\&.\&. connected\&. # Cloning 2 users\&.\&.\&. # Cloning joe@localhost to user sam:secret1@localhost # Cloning joe@localhost to user sally:secret2@localhost # \&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP The following command shows all users on the local server in the most verbose output in CSV format: .sp .if n \{\ .RS 4 .\} .nf shell> \fBmysqluserclone \-\-source=root@localhost \-\-list \-\-format=csv \-vvv\fR # Source on localhost: \&.\&.\&. connected\&. user,host,database joe,localhost,util_test rpl,localhost, sally,localhost,util_test sam,localhost,util_test joe,user,util_test .fi .if n \{\ .RE .\} .sp PERMISSIONS REQUIRED.PP The account used on the source server must have privileges to read the \fBmysql\fR database\&. The account used to connect to the destination server must have privileges to execute \fBCREATE USER\fR (and \fBDROP USER\fR if the \fB\-\-force\fR option is given), and privileges to execute \fBGRANT\fR for all privileges to be granted to the new accounts\&. .SH "COPYRIGHT" .br .PP Copyright \(co 2006, 2016, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. .sp .SH "SEE ALSO" For more information, please refer to the MySQL Utilities and Fabric documentation, which is available online at http://dev.mysql.com/doc/index-utils-fabric.html .SH AUTHOR Oracle Corporation (http://dev.mysql.com/).