Solved

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

Posted on 2011-03-11
2
1,066 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
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

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.

Question has a verified solution.

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

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

820 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