Outdated Version

You are viewing an older version of this section. View current production version.


Start or continue replicating a database from a remote host to a local database.

REPLICATE DATABASE db_name FROM master_user[:master_password]@master_host[:master_port][/master_db_name]


  • db_name is the name of the target database on the secondary MemSQL instance. REPLICATE DATABASE will always attempt to create a new database named db_name. The database name on the secondary does not need to match the name of its corresponding remote primary database.
  • MemSQL does not support granular security (see :ref:security_accounts), so master_user, master_password must grant access to the primary database. The password is assumed to be '’ if master_password is not specified explicitly.
  • master_host is the host name or IPv4/IPv6 pointing to the remote database. It can be quoted to allow special characters (e.g. “-", among others).
  • master_db_name is the name of the remote, primary database. If it is not specified explicitly, MemSQL attempts to replicate from db_name on the master MemSQL instance.
  • While replicating, the database is in the replicating state (see Database States).


  • The long form of CONTINUE REPLICATING can be used to re-point a replica from one master to another.

This MemSQL feature is only available in MemSQL Enterprise Edition. MemSQL Enterprise Edition includes 24x7 support and several enterprise-only features for critical deployments. For more information about MemSQL Community and MemSQL Enterprise, see the MemSQL Editions page.


memsql> REPLICATE DATABASE ExampleDatabase FROM root@master-host:3306;
Query OK, 1 row affected (0.32 sec)