drush sql-syncfor drush 6x
Copies the database contents from a source site to a target site. Transfers the database dump via rsync.
drush sql-sync
-
Arguments
sql-sync accepts 2 argument/s:
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.
-
Options
sql-sync accepts 28 option/s:
--skip-tables-key : A key in the $skip_tables array. See example.drushrc.php. Optional.
--skip-tables-list : A comma-separated list of tables to exclude completely. Optional.
--structure-tables-key : A key in the $structure_tables array. See example.drushrc.php. Optional.
--structure-tables-list : A comma-separated list of tables to include for structure, but not data. Optional.
--tables-key : A key in the $tables array. Optional.
--tables-list : A comma-separated list of tables to transfer. Optional.
--cache : Skip dump if result file exists and is less than "cache" hours old. Optional; default is 24 hours.
--no-cache : Do not cache the sql-dump file.
--no-dump : Do not dump the sql database; always use an existing dump file.
--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 : Path to dump file. Optional; default is to create a temporary file.
--source-database : A key in the $db_url (D6) or $databases (D7+) array which provides the data.
--source-target
--source-target : source-target
--target-db-url :
--target-remote-port :
--target-remote-host :
--target-dump :
--target-database : A key in the $db_url (D6) or $databases (D7+) array which shall receive the data.
--target-target
--target-target : target-target
--temp : Use a temporary file to hold dump files. Implies --no-cache.
--dump-dir : Directory to store sql dump files in when --source-dump or --target-dump are not used.
--create-db : Create a new database before importing the database dump on the target machine.
--db-su
--db-su : db-su
--db-su-pw
--db-su-pw : db-su-pw
--no-ordered-dump : Do not pass --ordered-dump to sql-dump. sql-sync orders the dumpfile by default in order to increase the efficiency of rsync.
--sanitize : Obscure email addresses and reset passwords in the user table post-sync. Optional.
-
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
-
Comments
comments powered by Disqus