Solved

Mysql DB on CentOS, daily cron job to dump DB?

Posted on 2011-03-11
2
1,079 Views
Last Modified: 2012-05-11
Say, I'm looking for a way to do a 3am backup of a MySQL DB on  a CentOS machine to a  remote machine.
0
Comment
Question by:shaunwingin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
tiago_aviz earned 500 total points
ID: 35107920
1- mysqldump -uroot -ppassword --all-databases > /backup/backup.sql
2- create an account named backup on the remote CentOS system
3- on the centos that has the mysql database, run ssh-keygen -t rsa, answer all the prompts, leave key with no password.
4- on the CenOS that has the mysql database, cat /root/.ssh/id_rsa.pub and paste its contents on the other CentOS system, at /home/backup/.ssh/authorized_keys.
5- the command to copy the database would be scp /backup/backup.sql root@othercentossystem:/home/backup/
6- create a script with commands 1 and 5 somewhere on the first centos box
7- open crontab -e on the mysql centos system and put:

00 3 * * * /place/where/you/saved/the/script/mysql-backup.sh

Save it! You should be good to go.

Hope this helps!
0
 

Author Closing Comment

by:shaunwingin
ID: 35108026
Will Test
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Creating and Managing Databases with phpMyAdmin in cPanel.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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