Solved

Copy MySql database from one linux server to another over SSH

Posted on 2006-11-27
6
938 Views
Last Modified: 2008-01-09
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
Comment
Question by:Isisagate
  • 4
  • 2
6 Comments
 
LVL 30

Accepted Solution

by:
todd_farmer earned 500 total points
Comment Utility
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
 
LVL 11

Author Comment

by:Isisagate
Comment Utility
Does it have the ability to restore the database backup to a remote server to?
0
 
LVL 30

Expert Comment

by:todd_farmer
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 30

Expert Comment

by:todd_farmer
Comment Utility
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
 
LVL 11

Author Comment

by:Isisagate
Comment Utility
Awesome Good Tool Suggestion!
0
 
LVL 30

Expert Comment

by:todd_farmer
Comment Utility
Glad it works for you - thanks for the points!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now