drush sql-dumpfor drush 8x


Exports the Drupal DB as SQL using mysqldump or equivalent.

drush sql-dump

  • Options


    sql-dump accepts 15 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.

    --result-file : Save to a file. The file should be relative to Drupal root. If --result-file is provided with no value, then date based filename will be created under ~/drush-backups directory.

    --create-db : Omit DROP TABLE statements. Postgres and Oracle only.  Used by sql-sync, since including the DROP TABLE statements interfere with the import when the database is created.

    --data-only : Dump data without statements to create any of the schema.

    --ordered-dump : Order by primary key and add line breaks for efficient diff in revision control. Slows down the dump. Mysql only.

    --gzip : Compress the dump using the gzip program which must be in your $PATH.

    --extra : Add custom options to the dump command.

    --database : The DB connection key if using multiple connections in settings.php.

    --target : The name of a target within the specified database connection. Defaults to 'default'.

    --db-url : A Drupal 6 style database URL.

  • Examples


    Save SQL dump to the directory above Drupal root.

    drush sql-dump --result-file=../18.sql

    Skip standard tables. @see example.drushrc.php

    drush sql-dump --skip-tables-key=common

    Pass extra option to dump command.

    drush sql-dump --extra=--no-data

  • Comments


    comments powered by Disqus