[...] Behold the power of Drush (once you are ssh'd in and navigated to your drupal root directory)
drush cc
drush sql-dump > ~/my-sql-dump-file-name.sql
Those two commands clear all the Drupal caches and then dump the sql database to a file in your home directory. Awesome sauce!
If the sql dump file is on a remote server, you can use this terminal command to download a copy of the sql file:
scp [email protected]:~/my-sql-dump-file-name.sql ~/Desktop/
You can use this command to import the sql dump back into your drupal database.
drush sql-drop
drush sql-cli < ~/my-sql-dump-file-name.sql
If you don't have Drush setup (which you should have setup if you want to be cool), you can check out this article to make a backup copy of your Drupal's MySQL database from a terminal: Drupal - How to Make a Backup Copy of MySQL Database
Redux of Tyler's article for my own gist-based shortcut recall purposes.http://tylerfrankenstein.com/code/use-drush-export-import-drupal-mysql-database-dump-file