Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

Thanks.

share|improve this question
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 '11 at 10:54
add comment

1 Answer

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 A@192.168.9.214

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 B@192.168.9.215:/home/user/Desktop

Step4 : Connect to the Server B as

ssh B@192.168.9.215

Step5 : Restore the copied dump here using mysql client utility

mysql -uroot -proot db < /home/user/Desktop/database_db1.sql
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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