drush sql-syncfor drush 8x


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 25 option/s:


    --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 : The destination for the dump file, or the path to the dump file when --no-dump is specified.

    --source-database : A key in the $db_url (D6) or $databases (D7+) array which provides the data.

    --source-target : A key within the SOURCE database identifying a particular server in the database group.

    --target-db-url : 

    --target-remote-port : 

    --target-remote-host : 

    --target-dump : A path for saving the dump file on target. Mandatory when using --no-sync.

    --target-database : A key in the $db_url (D6) or $databases (D7+) array which shall receive the data.

    --target-target : Oy. A key within the TARGET database identifying a particular server in the database group.

    --create-db : Create a new database before importing the database dump on the target machine.

    --db-su : Account to use when creating a new database. Optional.

    --db-su-pw : Password for the "db-su" account. Optional.

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