MySQL Sub-Library backup

Source: Internet
Author: User

MySQL Sub-Library backup


The first two articles have been written to the MySQL sub-database for backup, but there are users to my message that how to do the library automatic query database to do the backup, which makes me very depressed, so simple things, should be able to three evils in one swoop! Take a look.


VI mysql_backup.sh


#!/bin/sh

#backup Tiandao BBS edoing

#coding Tonye.li

Myuser=root

Mypass=meidi

Socket=/data/3306/mysql.sock

mycmd= "Mysql-u$myuser-p$mypass-s $SOCKET"

mydump= "Mysqldump-u$myuser-p$mypass-s $SOCKET"

For database in ' $MYDUMP-e ' show databases; "| Sed ' 1,2d ' |egrep-v "Mysql|schema"

Do

$MYDUMP $database |gzip >/server/backup/${database}_$ (date + $F). sql.gz

Done


Look at it!

This article is from "Lao Li _tony" blog, please be sure to keep this source http://tonyping.blog.51cto.com/7725720/1682995

MySQL Sub-Library backup

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.