Back up the MySQL database in linux and delete the Backup Data seven days ago

Source: Internet
Author: User

Back up the MySQL database in linux and delete the Backup Data seven days ago

#! /Bin/bash # backup database hz jshuabo sdhuaboname =$ (date + % Y % m % d) /alidata/server/mysql-5.1.73/bin/mysqldump-u root-p123456 hz>/root/sqlBackup/hz. $ name. SQL/alidata/server/mysql-5.1.73/bin/mysqldump-u root-p123456 jshuabo>/root/sqlBackup/jshuabo. $ name. SQL/alidata/server/mysql-5.1.73/bin/mysqldump-u root-p123456 sdhuabo>/root/sqlBackup/sdhuabo. $ name. SQL # Delete the backup file file_path = "/root/sqlBackup" # method a # rm-rf 'Find $ file_path '*. SQL '-mitime 7-print'> delete. log; # method bfind $ file_path-mtime + 7-type f | xargs rm-f # method c # rm-f 'Find $ file_path-mtime + 7-type F'


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.