第七步,根据日志恢复数据
| [root@serv01 data]# mysqlbinlog --stop-datetime "2013-09-10 19:37:45" mysql-bin.000001 | mysql -uroot -p123456 mysql> select * from stu; +------+---------+------+ | sid | sname | cid | +------+---------+------+ | 1 | larry01 | 1 | +------+---------+------+ 1 row in set (0.00 sec) mysql> select * from class; +------+-------+ | cid | cname | +------+-------+ | 1 | linux | | 2 | dab | | 3 | Devel | +------+-------+ 3 rows in set (0.00 sec) #规律:恢复的时间点(或者是Commit之后的那个时间点)是发生事故的那个点再加上一秒。 [root@serv01 data]# mysqlbinlog --stop-datetime "2013-09-10 19:37:46" mysql-bin.000001 | mysql -uroot -p123456 mysql> select * from stu; +------+----------+------+ | sid | sname | cid | +------+----------+------+ | 1 | larry007 | 1 | +------+----------+------+ 1 row in set (0.00 sec) mysql> select * from class; +------+-------+ | cid | cname | +------+-------+ | 1 | linux | | 2 | dab | | 3 | Devel | | 3 | Devel | +------+-------+ 4 rows in set (0.00 sec) [root@serv01 data]# mysqlbinlog mysql-bin.000001 # at 7131 #130910 19:37:45 server id 1 end_log_pos 7240 Query thread_id=20 exec_time=996 error_code=0 SET TIMESTAMP=1378813065/*!*/; update stu set sname="larry007" where sid=1 /*!*/; # at 7240 #130910 19:37:45 server id 1 end_log_pos 7312 Query thread_id=20 exec_time=996 error_code=0 SET TIMESTAMP=1378813065/*!*/; COMMIT /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; |
以上就是本文的全部内容,不知道大家是否有所收获,联系前几篇的内容进行理解,学习效果会更好哦










