mysqlbinlog恢复数据
1.在binglog中去查找相关记录
将误删表中的数据保存到delete.txt文件中:
mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS mysql-bin.000303| grep -A '10' 't_commission_ebao_bank' > delete.txt
2.将记录转换成sql语句
cat delete.txt | sed -n '/###/p' | sed 's/### //g;s/\/\*.*/,/g;s/DELETE FROM/INSERT INTO/g;s/WHERE/SELECT/g;' | sed -r 's/(@4.*),/\1;/g' | sed 's/@[1-9]=//g' > t1.sql
3.导入数据,验证数据完整性
source t1.sql;