问题一
- 查看二进制文件时没有数据库相关操作内容
- 因为在创建库及表格以及插入内容的相关操作时在开启二进制日志功能之前进行的。开启二进制功能后只进行了一条插入操作,所以查看时空白,恢复时无效。应先开启二进制日志功能再进行相应操作以及模拟数据丢失
问题二
- 二进制日志节点恢复时不显示–start-position='1250’后的操作
- 原因:在位置节点1250后的1613节点又执行了删除表的操作
# at 1154
#210420 12:11:04 server id 1 end_log_pos 1250 CRC32 0xdcdc9e2b Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1618891864/*!*/;
insert into qa values(002)
/*!*/;
# at 1613
#210420 12:11:23 server id 1 end_log_pos 1724 CRC32 0x9b9f4718 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1618891883/*!*/;
DROP TABLE "qa" /* generated by server */
/*!*/;
[root@192 data]# mysqlbinlog --no-defaults --stop-position='1154' mysql-bin.000009 | mysql -uroot -p5514
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@192 data]# mysqlbinlog --no-defaults --start-position='1250' mysql-bin.000009 | mysql -uroot -p5514
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql> select * from qa;
+------+
| id |
+------+
| 4 |
| 3 |
+------+
2 rows in set (0.00 sec)