Mysql Remote Backup and address encoding issues script _ MySQL

Source: Internet
Author: User
Mysql Remote Backup and encoding script bitsCN.com

#! /Bin/bash
IP = 192.168.0.198
Mysqlpath =/usr/local/mysql/bin
Variables = '$ mysqlpath/mysql-u root-pmima-h $ IP-e "show variables like 'character/_ set/_ % '; "| awk '{print $2}' | sed-n '4' P'
$ Mysqlpath/mysqldump-uroot-pmima-h $ IP -- default-character-set = $ variables keyword_ad>/back/mysqldb/s198db/keyword_ad _ $ (date + % Y % m % d ). SQL;
$ Mysqlpath/mysqldump-uroot-pmima-h $ IP -- default-character-set = $ variables mysql>/back/mysqldb/s198db/s198mysql _ $ (date + % Y % m % d ). SQL;
Sleep 180 s
Cd/back/mysqldb/s198db/
/Bin/tar zcf keyword_ad _ $ (date 1_y1_m1_d1_.tar.gz keyword_ad _ $ (date + % Y % m % d). SQL
/Bin/tar zcf s198mysql _ $ (date using policy1_m1_d1_.tar.gz s198mysql _ $ (date + % Y % m % d). SQL
Sleep 60 s
/Usr/bin/find/back/mysqldb/s198db/-name "* .tar.gz"-mtime + 5-exec rm-rf {}/;
Sleep 60 s
/Usr/bin/find/back/mysqldb/s198db/-name "*. SQL"-mtime + 1-exec rm-rf {}/;

This article is from the blog "learning is everlasting ".

BitsCN.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.