drush sql-sync

Copies the database contents from a source site to a target site. Transfers the database dump via rsync.

Drush Command

drush sql-sync

Arguments

source : A site-alias or the name of a subdirectory within /sites whose database you want to copy from.
target : A site-alias or the name of a subdirectory within /sites whose database you want to replace.

Aliases

Options

--skip-tables-key : A key in the $skip_tables array. @see example.drushrc.php. Optional.
--structure-tables-key : A key in the $structure_tables array. @see example.drushrc.php. Optional.
--tables-key : A key in the $tables array. Optional.
--skip-tables-list : A comma-separated list of tables to exclude completely. Optional.
--structure-tables-list : A comma-separated list of tables to include for structure, but not data. Optional.
--tables-list : A comma-separated list of tables to transfer. Optional.
--no-dump : Do not dump the sql database; always use an existing dump file.
--no-sync : Do not rsync the database dump file from source to target.
--runner : Where to run the rsync command; defaults to the local site. Can also be "source" or "destination".
--source-db-url : Database specification for source system to dump from.
--source-remote-port : Override sql database port number in source-db-url. Optional.
--source-remote-host : Remote machine to run sql-dump file on. Optional; default is local machine.
--source-dump : [object Object]
--source-database : A key in the $db_url (D6) or $databases (D7+) array which provides the data.
--source-target : [object Object]
--target-db-url : 
--target-remote-port : 
--target-remote-host : 
--target-dump : [object Object]
--target-database : A key in the $db_url (D6) or $databases (D7+) array which shall receive the data.
--target-target : [object Object]
--create-db : Create a new database before importing the database dump on the target machine.
--db-su : [object Object]
--db-su-pw : [object Object]
--sanitize : Obscure email addresses and reset passwords in the user table post-sync.

Examples

Copy the database from the site with the alias "source" to the site with the alias "target".

drush sql-sync @source @target
Copy the database from the site in /sites/prod to the site in /sites/dev (multisite installation).
drush sql-sync prod dev