This utility enables you to clone an existing MySQL server
instance to create a new server instance on the same host. The
utility creates a new datadir
--new-data), and, on
Unix systems, starts the server with a socket file. You can
optionally add a password for the login user account on the new
If the user does not have read and write access to the folder
specified by the
--new-data option, the
utility shall issue an error.
Similarly, if the folder specified by
--new-data exists and is
not empty, the utility will not delete the folder and will issue
an error message. Users must specify the
--delete-data option to
permit the utility to remove the folder prior to starting the
mysqlserverclone accepts the following command-line options:
Display a help message and exit.
Display license information and exit.
Delete the folder specified by
--new-dataif it exists and is not empty.
Ignore the maximum path length check for the
Additional options for mysqld. To specify multiple options, separate them by spaces. Use appropriate quoting as necessary. For example, to specify
--mysqld="--log-bin=binlog --general-log-file='my log file'"
The full path to the location of the data directory for the new instance. The path size must be 200 characters or less.
server_idvalue for the new server instance. The default is 2.
The port number for the new server instance. The default is 3307.
Turn off all messages for quiet execution.
The password for the
rootuser of the new server instance.
Connection information for the server to be cloned.
To connect to a server, it is necessary to specify connection parameters such as user name, host name, password, and either a port or socket. MySQL Utilities provides a number of ways to provide 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.
Use login-paths from your
.mylogin.cnffile (encrypted, not visible). Example : <login-path>[:<port>][:<socket>]
Use a configuration file (unencrypted, not visible) Note: available in release-1.5.0. Example : <configuration-file-path>[:<section>]
Specify the data on the command-line (unencrypted, visible). Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
Number of seconds to wait for server to start. Default = 10 seconds.
Specify how much information to display. Use this option multiple times to increase the amount of information. For example,
-vv= more verbose,
Display version information and exit.
Path name of file in which to write the command used to launch the new server instance.
The following command demonstrates how to create a new instance of
a running server, set the
root user password
and enable binary logging:
mysqlserverclone --server=root:pass@localhost \
--new-data=/Users/cbell/source/test123 --new-port=3310 \
--root-password=pass --mysqld=--log-bin=mysql-bin# Cloning the MySQL server running on localhost. # Creating new data directory... # Configuring new instance... # Locating mysql tools... # Setting up empty database and mysql tables... # Starting new instance of the server... # Testing connection to new instance... # Success! # Setting the root password... # ...done.
The user must have permission to read all databases. Since we are using the root account for these examples (and you typically would), permissions are not generally a problem.
You also need permissions to create the new data directory and write data to it.