MySQL backup script

Source: Internet
Author: User
Tags mysql backup
#!/bin/bash#time:2016-11-8#owner:fujinzhou#scriptname:mysqlback.sh# the name of the database to be backed up, multiple databases are separated by spaces db= (Zabbix reboot10) # Backup directory Backuppath= "/data/backup/" if [!-D "$BACKUPPATH"]; Then Mkdir-p "$BACKUPPATH" fi# loop dbfor db in ${db[*]} do CD $BACKUPPATH #备份并打包数据库生成的sql文件/bin/nice-n 19/usr /bin/mysqldump--defaults-file=/root/.my.cnf $db > ${db}_$ (Date +%y%m%d). SQL && tar zpcf ${db}_$ (date +%y%m%d ). sql.tar.gz ${db}_$ (date +%y%m%d). SQL done# Delete the previous SQL file Rm-rf $BACKUPPATH *.sql


This article from "Do not abandon!" Do not give up "blog, be sure to keep this source http://thedream.blog.51cto.com/6427769/1870676

MySQL backup script

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.