前提:log_bin=ON
1 全备份
mysqldump -A -F --single-transaction --master-data=2 > /backup/full.sql
2 10:00前修改数据
insert students
3 10:00 删除表
drop table students;
4 10:00-10:10 修改数据库
insert teachers;
还原
5 mysql> flush tables with read lock;
6 mysql> show master logs; 查看binlog的position
7 mysql> flush logs; 生成新日志
8 head /backup/full.sql 查看全备份的position ,确定全备份到目前之间的所有日志文件及position
如: /data/binlog/mysql-bin.000019 245
9 mysqlbinlog --start-position=245 /data/binlog/mysql-bin.000019 > /backup/bin.sql
10 vim /backup/bin.sql 找误删除的语句,删除此语句
11 systemctl stop mariadb
rm -rf /data/mysql/*
systemctl start mariadb
mysql < /backup/full.sql
mysql < /backup/bin.sql