Mysql full backup _ MySQL

Source: Internet
Author: User
Mysql full backup bitsCN. com1. check which databases are available in mysql
Mysql> show databases G
* *************************** 1. row ***************************
Database: information_schema
* *************************** 2. row ***************************
Database: mysql
* *************************** 3. row ***************************
Database: test
3 rows in set (0.00 sec)
2. perform full backup
Sh back. sh
Back. sh
#! /Bin/sh
Export back_dir =/data/bak
Export pass = "123"
Export mysql_dir =/usr/local/mysql-5.1.56
For I in $ (mysql-uroot-p $ pass-e show databases G | grep Database | cut-d:-f2)
Do
$ Mysql_dir/bin/mysqldump -- opt $ I-p $ pass -- skip-lock-tables> $ back_dir/$ I. $ (date + % Y % m % d). SQL
Done
# Use fetion to notice dba
LD_LIBRARY_PATH =/usr/lib/usr/local/fetion -- mobile = 159xxxx3240 -- pwd = 123456 -- to = 159xxxx3240 -- msg-utf8 = mysql backup is success!
3. schedule tasks
Crontab-e
0 3 *** sh/usr/bin/back.shbitsCN.com

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.