I have very specific question. I have seen the instructions on how to backup and restore mysql database using SSH but they barely explain the process when backing up on one server and restoring on another server.

What i need is backup the mysql database on server A and restore the mysql database on server B. How do i do this using SSH command line?

I have seen this http://www.ipragmatech.com/backup-restore-mysql but nothing on backing up and restoring on different servers.


  • 2
    What OS and what edition of MySQL please? Out of the box, MySQL doesn't have on-line consistent backups so the solution depends on a few things (for example, we use ZFS snapshots)
    – gbn
    Dec 5, 2011 at 10:54

1 Answer 1


As from your question if the scenario is like that.

You are on your local machine and accessing the remote servers A and B.

Process is simple

Step1 : Connect to server A where A is username of server

ssh [email protected]

Step2 : Generate the database dump of the server A as

mysqldump -uroot -proot  db1  > database_db1.sql

Step3 : Copy the dump on the server B using SCP as

scp database_db1.sql [email protected]:/home/user/Desktop

Step4 : Connect to the Server B as

ssh [email protected]

Step5 : Restore the copied dump here using mysql client utility

mysql -uroot -proot db < /home/user/Desktop/database_db1.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.