MySQL 误删数据恢复

499人浏览 / 0人评论

参考:

https://blog.csdn.net/qq_36881887/article/details/124229654

查看binlog是否开启:

use mysql;
show variables like 'log_bin';

查询binlog日志:

show binlog EVENTS;
show binlog EVENTS in 'mysql-bin.000004';
show binlog EVENTS in 'mysql-bin.000004' from 1520 LIMIT 0, 10;

数据恢复:

# --start-position 日志起始位置 --stop-position 日志截止位置,可将binlog日志下载到本地查看确定起始位置和截止位置
mysqlbinlog /var/lib/mysql/mysql-bin.000004 --start-position 1974 --stop-position 2250  | mysql -uroot -p123456

全部评论