mysql> show binarylogs;+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 593 |
+------------------+-----------+
1 row in set (0.00sec)
mysql>flush logs;
Query OK,0 rows affected (0.01sec)
mysql>show binlog events;+------------------+-----+-------------+-----------+-------------+---------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----+-------------+-----------+-------------+---------------------------------------------------------+
| mysql-bin.000001 | 4 | Format_desc | 1 | 107 | Server ver: 5.5.22-log, Binlog ver: 4 |
| mysql-bin.000001 | 107 | Query | 1 | 175 | BEGIN |
| mysql-bin.000001 | 175 | Query | 1 | 270 | use `jack`; insert into echo values(4,'ccc') |
| mysql-bin.000001 | 270 | Xid | 1 | 297 | COMMIT /*xid=176*/ |
| mysql-bin.000001 | 297 | Query | 1 | 365 | BEGIN |
| mysql-bin.000001 | 365 | Query | 1 | 460 | use `jack`; insert into echo values(5,'ddd') |
| mysql-bin.000001 | 460 | Xid | 1 | 487 | COMMIT /*xid=177*/ |
| mysql-bin.000001 | 487 | Query | 1 | 593 | use `jack`; DROP TABLE `echo` /*generated by server*/ |
| mysql-bin.000001 | 593 | Rotate | 1 | 636 | mysql-bin.000002;pos=4 |
+------------------+-----+-------------+-----------+-------------+---------------------------------------------------------+
9 rows in set (0.00sec)----从上面可以看出drop table 是在487----
mysql> show binarylogs;+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 636 |
| mysql-bin.000002 | 107 |
+------------------+-----------+
2 rows in set (0.00sec)
mysql> show binlog events in 'mysql-bin.000001'\G;*************************** 1. row ***************************Log_name: mysql-bin.000001Pos:4Event_type: Format_desc
Server_id:1End_log_pos:107Info: Server ver:5.5.22-log, Binlog ver: 4
*************************** 2. row ***************************Log_name: mysql-bin.000001Pos:107Event_type: Query
Server_id:1End_log_pos:175Info:BEGIN
*************************** 3. row ***************************Log_name: mysql-bin.000001Pos:175Event_type: Query
Server_id:1End_log_pos:270Info:use `jack`; insert into echo values(4,'ccc')*************************** 4. row ***************************Log_name: mysql-bin.000001Pos:270Event_type: Xid
Server_id:1End_log_pos:297Info:COMMIT /*xid=176*/
*************************** 5. row ***************************Log_name: mysql-bin.000001Pos:297Event_type: Query
Server_id:1End_log_pos:365Info:BEGIN
*************************** 6. row ***************************Log_name: mysql-bin.000001Pos:365Event_type: Query
Server_id:1End_log_pos:460Info:use `jack`; insert into echo values(5,'ddd')*************************** 7. row ***************************Log_name: mysql-bin.000001Pos:460Event_type: Xid
Server_id:1End_log_pos:487Info:COMMIT /*xid=177*/
*************************** 8. row ***************************Log_name: mysql-bin.000001Pos:487Event_type: Query
Server_id:1End_log_pos:593Info:use `jack`; DROP TABLE `echo` /*generated by server*/
*************************** 9. row ***************************Log_name: mysql-bin.000001Pos:593Event_type: Rotate
Server_id:1End_log_pos:636Info: mysql-bin.000002;pos=4
9 rows in set (0.00sec)
ERROR:
No query specified