[英]MySQL point-in-time recovery
我有一个启用了二进制日志记录的系统,并且每晚执行一次mysqldump(单事务,全部为InnoDB)。 如果我想执行时间点恢复,我怎么知道二进制日志中的哪一点开始向前滚动? 例如。
bin-log.000001包含我的dump.sql文件之前和之后的所有更改。 如果我做:
mysql < dump.sql
要恢复到最后一次完整导出,然后使用以下命令前滚到最新点:
mysqlbinlog bin-log.000001 | mysql
MySQL会知道合适的起点吗?
所以,是的,更多的研究已经使我在这里 。 以防万一其他人想知道。
查看mysqlbinlog的用法:
--stop-datetime=name
Stop reading the binlog at first event having a datetime
equal or posterior to the argument; the argument must be
a date and time in the local time zone, in any format
accepted by the MySQL server for DATETIME and TIMESTAMP
types, for example: 2004-12-25 11:25:56 (you should
probably use quotes for your shell to set it properly).
似乎恰好可以做您想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.