I told you here a way to backup remote MySQL databases using a mix of AppleScript and shell script (ssh).
But that method won’t work with certain table types, which don’t store the data in files, such as InnoDB. So, here is a one-liner using mysqldump to backup that kind of databases…
mysqldump --opt --compress --host='website.com' --user='USER' --password='PWD' --all-databases | mysql -uUSER -pPWD -h127.0.0.1
Just substitute where needed USER and PWD. This shell script requires MySQL running in both machines and privileges to access the data in both sides.
IMHO, it runs much slower than the other method (making a copy of the remote db files) so, if you can use it, go for it! Otherwise, this method is safe for your data (safe if you don’t lose power or internet connection in the process 😉 ).
See “man mysqldump” for more options (such as extracting only certain databases or tables, as this script will backup everything!).