• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1026
  • Last Modified:

Copy MySql database from one linux server to another over SSH

I am trying to setup a simple backup script for my production database so when I run it it will copy copy the data from the production linux machine to my local linux development box. I have MySql 4.0 running on both linux boxes. They will need to communicate through SSH. I want this to be as automated as possible so I can setup a cron job for it later.

Any ideas?
0
Isisagate
Asked:
Isisagate
  • 4
  • 2
1 Solution
 
todd_farmerCommented:
Take a look at http://sourceforge.net/projects/automysqlbackup/ - I use this to backup my production box.  It's easy to configure using crontab.
0
 
IsisagateAuthor Commented:
Does it have the ability to restore the database backup to a remote server to?
0
 
todd_farmerCommented:
Not directly, but it's easy to include that in a shell script.  Just configure automysqlbackup on your local machine to connect to the remote machine and generate the SQL dump file locally, then execute:

mysql --user=user_name --password=pass db_name < /path/to/backup.sql
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
todd_farmerCommented:
You can do it in one command, as well:

mysqldump --host=[remote host] --user=[remote user] --password=[remote password] -C db_name | mysql --host=localhost --user=[local user] --password=[local password] db_name


0
 
IsisagateAuthor Commented:
Awesome Good Tool Suggestion!
0
 
todd_farmerCommented:
Glad it works for you - thanks for the points!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now