Automatic backup of MySQL under CentOS

Source: Internet
Author: User

Automatically backs up MySQL databases under CentOS and synchronizes the differences to other network hosts

1, add backup.sh:vim/root/mysql_backup/backup.sh under/root/mysql_backup/, then add the following code inside:

Mysqldump-uroot-p ' a123456 ' mysqltest >/root/mysql_backup/' Date +%y-%m-%d~%h:%m:%s '. bak//BACKUP Database

rsync-av/root/mysql_backup/* [Email protected]:/root/backup///diff sync backup file

2, add the plan, run the command: CRONTAB-E, and then add the following content:

* */1 * * */bin/bash/root/mysql_backup/backup.sh//hourly Run backup.sh

3. Re-run the program: Service Crond restart

PS: Before running backup.sh, you need to ensure that the local SSH key access is available 172.16.0.88

Automatic backup of MySQL under CentOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.