Mysqldump full-Backup shell script sharing

Source: Internet
Author: User

Mysqldump full backup shell script sharing today, the tester urged that the relevant bug database data must be backed up, and the full backup should be performed on a daily basis; for this database with a small amount of data, I feel that it is not necessary to become a mentor so that I can develop two sets of solutions for maintenance at the same time! However, if the requirement is raised, we need to solve it. The following is a simple full-Backup mysqldump script written in the morning ;#! /Bin/sh ################################ this script is used for full data backup # Justin sun # Make a full backup every Sunday ############################# ### set the user name and password v_user = "root" v_password = "DataBase4862) (* 7 "# mysql installation path MysqlDir =/usr/local/bin # backup database =" bugtracker "# Set the backup path, create backup folder BackupDir =/data/Mysql_BackupFull_Backup = $ BackupDir/Full_backup mkdir-p $ Full_Backup/$ (date + % Y % m % d) # Start backup, record backup start time echo '=========' $ (date + "% Y-% m-% d % H: % M: % S ") '==========' "backup start"> $ Full_Backup/full_buckup.log $ MysqlDir/mysqldump-u $ v_user-p $ v_password -- single-transaction -- flush -logs -- databases $ database> $ Full_Backup/$ (date + % Y % m % d) /full_backup. SQL # compress the backup file gzip $ Full_Backup/$ (date + % Y % m % d) /full_backup. SQL echo '===========' $ (date + "% Y-% m-% d % H: % M: % S ") '==========' "backup completed"> $ Full_Backup/full_buckup.log
 

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.