如何使用mysql二进制日志从drop database命令还原? [英] How do I restore from a drop database command using a mysql binary log?

查看:316
本文介绍了如何使用mysql二进制日志从drop database命令还原?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何恢复使用"drop database"命令删除的mysql数据库?我可以访问二进制日志,这应该使这种回滚成为可能.

How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.

推荐答案

文档很烂.它暗示了DROP DATABASE是可恢复的,但仅在奇怪的条件下,我对 http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

Documentation Sucks. It alludes to DROP DATABASE being recoverable, but only in odd conditions i'm not familiar with http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

根据文档,binlog只是基于给定参考点执行的一系列命令.因此,当您执行"DROP DATABASE"时,不要去哦,要删除数据库,我们现在应该备份,以防万一",它只是在最后一个binlog中写入了"DROP DATABASE".恢复并不像向后播放磁带那样简单.

According to Docs, binlogs are just a sequence of commands executed based on a given reference point. So that when you did "DROP DATABASE", instead of going "Oh, hes droppping the database, we should back up now just in case" it merely wrote a "DROP DATABASE" to the last binlog. Recovery is not as simple as playing the tape backwards.

您需要做的是从最后一个已知商品中恢复数据库,并应用在该恢复点和DROP命令之间发生的二进制日志.

What you need to do is recover the database from a last-known-good, and apply the binlogs that happened between that recover point and the DROP command.

http://dev.mysql.com/doc/refman/5.0/en/recovery-from-backups.html

一个人如何确定要使用哪些二进制日志,尚不清楚.

How one determines which binlogs to use tho, unclear.

没有什么比完整的文件系统备份更好了.而且您至少应该让它们退回去.

There is nothing better than having full file system backups. And you should at least have these to fall back to.

这篇关于如何使用mysql二进制日志从drop database命令还原?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆