How do I set the path/save location inside terminal for backing up a remote SQL database via SSH? I would like to save a backup to my desktop. I’m new to SSH, but have managed to log in and interact with the DB.
I tried this, but it said there was no such file or directory.
mysqldump -u user -p database > /Users/Me/Desktop/backup.sql
Thanks.
After creating the backup, use SCP to get the file.
So, to SSH:
Then, in SSH:
Then, do SCP (to copy to local directory):
Think of SSH like remote desktop; the point of SSH is to log into another computer. The point of using SSH in the terminal is not for file transfer; it’s to do something on the server. SCP is made to copy the file from a remote location. So use SSH to do what you need to do (here, backup the database), and then use SCP to copy the file(s).