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