drush sql-syncfor drush 7x


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 24 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.

    --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.

    --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

    --source-dump : source-dump

    --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-dump : 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

    --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

    --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

  • Comments


    comments powered by Disqus