truncate table recovery: 1, test Data mysql> select count (*) from o_order;+----------+| count (*) |+----------+| 34 |+----------+1 row in set (0.00 sec) 2, Truncate table mysql> truncate table o_ Order query ok, 0 rows affected (0.05 SEC) mysql> select count (*) from o_order;+----------+| count (*) |+----------+| 0 |+----------+1 row in set (0.00 sec) 3, forced flush log mysql> flush Logs query ok, 0 rows affected (0.01 sec) mysql> show master status; +---------------------+----------+------------------+------------------+-------------------+| file | position | binlog_do_db | binlog_ignore_db | executed_gtid_set |+----------------- ----+----------+------------------+------------------+-------------------+| mysql_binlog.000009 | 120 | history,realtime | mysql | |+---------------------+----------+------------------+-- ----------------+-------------------+1 row in set (0.00 sec) 4. Restore from backup first: mysql> \ . his.sql Note: If no backup data, then to restore Log 5, locate log location '/*!*/;# at 1607#141128 0:54:29 server id 1 end_log_pos 1638 crc32 0x69cfa1df xid = 1734commit/*!*/;# at 1638#141128 1:06:23 server id 1 end_log_pos 1730 crc32 0xb0178972 Query thread_id=34 exec_time=1 error_code =0use ' History '/*!*/; SET TIMESTAMP=1417107983/*!*/;TRUNCATE TABLE O_ORDER6, recovering data [[email protected] ~]# mysqlbinlog -d history --stop-position=1638 /data/mysql/mysql_binlog.000008 | MYSQL7, check Data mysql> select count (*) from o_order;+----------+| count (*) |+----- -----+| 34 |+----------+1 row in set (0.00  SEC)
This article is from the "Dead Leaf" blog, please make sure to keep this source http://mydbs.blog.51cto.com/513727/1745286
Synchronizing the same structure database data