Say you ssh into a server as the user deployer
and have a folder on the server ~/dump
:
# on the server you are logged into
# backup the database
mysqldump -uroot -pstrongPassword railsapp_staging > ~/dump/YYYYMMDD_railsapp_staging.sql
# next logout/exit your ssh session to the server above
exit
# now download the backup from the above server
# say you have a folder db/dump in the local folder you are in
scp [email protected]:dump/YYYYMMDD_railsapp_staging.sql db/dump/.
# restore from backup file to local development mysql
mysql -uroot -plocalPassword railsapp_staging < YYYYMMDD_railsapp_staging.sql