mysql邏輯備份

來源:互聯網
上載者:User

標籤:nbsp   tran   war   ase   mysqldump   $1   warning   日誌   using   

一、邏輯備份

1.mysqldump

備份策略
    1.邏輯熱備
    2.備份周期
          保留一周,日誌保留一周,本地備份
    3.crontab

目錄規劃
mkdir -p /mysqldump/{log,data,bash}

備份使用者

grant select on *.* to ‘bkusr‘@‘192.168.110.%‘ identified by ‘bkpwd‘;
flush privileges;

備份指令碼

mkdir -p /mysqldump/{log,data,bash}
cd /mysqldump/bash
vim mysqldump.sh

#!/bin/sh
bkusr=bkusr
bkpwd=bkpwd
bkhst=`ip a|grep ‘inet ‘|awk -F"/" ‘/[1][9][2][.][1][6][8]*/{print $1}‘|awk ‘{print $2}‘`
bkpt=3306
bkdir="/mysqldump/data"
mysqldump -u${bkusr} -p${bkpwd} -h${bkhst} -P${bkpt} --single-transaction --all-databases > $bkdir/all_databases_${bkhst}_${bkpt}_`date +%F`.sql

 

故障:

# time ./mysqldump.sh
Warning: Using a password on the command line interface can be insecure.
mysqldump: Couldn‘t execute ‘show create table `vw_gm_stat`‘: SHOW VIEW command denied to user ‘bkusr‘@‘xxx.xxx.xxx.xxx‘ for table ‘vw_gm_stat‘ (1142)

許可權問題,加上即可

 

mysql邏輯備份

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.