[Mysql] daily backup shell script and mysql backup shell script

Source: Internet
Author: User
Tags mysql backup

[Mysql] daily backup shell script and mysql backup shell script

Use mysqldump to back up mysql Data at a fixed time every day.

#! /Bin/bash # mysql backup data orangleliu # chmod 700 backup every morning. sh # crontab-e #0 4 ***/home/erya/run/moniter/mysql_backup.shuser = "radius" password = "" host = "localhost" db_name = "radius "# backup directory base_dir = "/home/backup" backup_log = "$ {base_dir}/mysql_backup.log" backup_path =$ {base_dir} # file infodate = $ (date + "% Y-% m -% d ") filename = $ backup_path/mongodb_name-mongodate. SQL .gz umask 177 # back up mysqldump -- user = $ user -- password = $ password -- host = $ host $ db_name | gzip> $ filename # Delete files older than 10 daysfind $ backup_path/*-mtime + 10-exec rm {}\; echo "backup finished at $ (date + '% Y-% m-% d % H: % M: % s')"> "$ backup_log"

Reference

  • Mysql-backup

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.