Solved

Copy MySql database from one linux server to another over SSH

Posted on 2006-11-27
6
942 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
ID: 18019970
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
ID: 18020286
Does it have the ability to restore the database backup to a remote server to?
0
 
LVL 30

Expert Comment

by:todd_farmer
ID: 18020326
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 30

Expert Comment

by:todd_farmer
ID: 18023866
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
ID: 18072179
Awesome Good Tool Suggestion!
0
 
LVL 30

Expert Comment

by:todd_farmer
ID: 18074577
Glad it works for you - thanks for the points!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

11 Experts available now in Live!

Get 1:1 Help Now