Skip to content

Dumping Your MySQL data (schema and data) from a Remote Server to Another

Posted on:January 27, 2024 at 03:57 PM

I wanted to move batabases to a a new remote db from what we had previously where database and our core API server was hosted in the same instance.

To do this I have to scp which is basically ssh but for copying files.

You go to the location of your perm keys or just describe the location and then the host alonside the file location with a single ”:” between these two properties.

And the last string you’re adding to this command line is the location you want to download it to and of course whatever you want the file to be called.

This was the result when I downloaded the file.

scp -i dev_backend_key.pem ubuntu@ec2-16-271-019-959.eu-north-1.compute.amazonaws.com:/var/www/dump.sql /Users/your_name/backend_server
dump.sql

100% 673KB 1.5MB/s 00:00

NB: You can decide to pull the schema without the data or do both. I did both for my situation.