Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-11
2
Medium Priority
?
1,094 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 2000 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

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

705 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