Drupal - Use Drush to Export/Import a MySQL Database Dump File

Export Database to File

Drupal 6 and 7

drush cc

drush sql-dump > ~/my-sql-dump-file-name.sql

drush sql-dump --gzip --result-file=backupdbsite.sql

Drupal 8

drush cr

drush sql-dump > ~/my-sql-dump-file-name.sql

drush sql-dump --gzip --result-file=backupdbsite.sql

Import Database

gzip -d my-sql-dump-file-name.sql.gz

drush sql-drop

drush sql-cli < ~/my-sql-dump-file-name.sql