查看: 888|回复: 0

Windows下,MySql使用binlog恢复表和数据初级教程

[复制链接]

77

主题

77

帖子

251

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
251
发表于 2019-10-18 05:18:15 | 显示全部楼层 |阅读模式
17:20


2019-08-12 17


mysqlbinlog mysql-bin.000036|grep -C 5 "delete from"


show binlog events in 'mysql-bin.000036';-- 查看binlog内容记录下开始位置和结束位置



mysql-bin.000036


mysqlbinlog --start-datetime="2019-08-12 17:00:00" --stop-datetime="2019-08-12 17:30:00" mysql-bin.000036 | mysql -u root -p


mysql -hlocalhost -uroot -pmzjl70522

mzjl70522


mysqlbinlog --start-datetime="2019-08-12 17:00:00" --stop-datetime="2019-08-12 17:30:00" mysql-bin.000036 > C:\test1.sql


mysqlbinlog --start-position=1013255948 --stop-position=1013685633 mysql-bin.000036 > C:\\test1.sql

mysqlbinlog --start-position=1013255948 --stop-position=1013685633 mysql-bin.000036 > C:\test1.sql

1013255948    1013685633



mysqlbinlog –database=49oassc –start-position=1013255948 –stop-position=1013685633 mysql-bin.000036 > C:\\test1.sql




mysqlbinlog --no-defaults --start-position=1013255948 --stop-position=1019080404 mysql-bin.000036 > C:\\test1.sql



source C://test1.sql

https://blog.csdn.net/chl191623691/article/details/78351768

https://lixuanbin.iteye.com/blog/2250897

use `49oassc`; DELETE FROM g_zhudan WHERE g_nid = 'zh1234'


2019-08-12 17:11:56


mysql-bin.000036,1013255948,Query,1,1013256132,use `49oassc`; INSERT INTO `j_manage` ( `g_login_id` , `g_nid` , `g_name` )VALUES ('89','67552ea64c6dce1646a263bae714e788','test1'


mysql-bin.000036,1013685434,Query,1,1013685633,use `49oassc`; UPDATE `j_manage` SET `g_name`='test1',`g_f_name`='test1',`g_auto`='1',`g_gg`='1',`g_gd`='1',`g_zhud`='1',`g_cj`='1' WHERE g_id='275'



1013255948    1013685633  1019080404




)VALUES ('89','67552ea64c6dce1646a263bae714e788','test1'

mysql-bin.000036,1013255948,Query,1,1013256132,use `49oassc`; INSERT INTO `j_manage` ( `g_login_id` , `g_nid` , `g_name` )VALUES ('89','67552ea64c6dce1646a263bae714e788','test1'


mysql-bin.000036,1016057134,Query,1,1016057778,use `49oassc`; INSERT INTO g_user (g_nid, g_login_id, g_name, g_f_name, g_mumber_type, g_password, g_money, g_money_yes, g_distribution, g_panlus,g_panlu, g_xianer, g_out, g_look, g_ip, g_date, g_uid, money_dx) VALUES (
                '67552ea64c6dce1646a263bae714e78861e696e5d26cb6c54c4ad20187c164002c4c4f5430b6700d5a7d448c0587130d',
                '22',
                'ceshi',
                '测试账户',
                '2',
                '89e89c17f877ca2821b557f633cec3253b0aa941',
                '5000',
                '5000',
                '10',
                'A,',
                'A',
                '5000000',
                '0',
                '1',
                '27.18.180.226',
                '2019-08-12 17:13:33',
                'dd9732c0d8ae7549eee72789009976e6',
                '五千')




mysql-bin.000036,1014722666,Query,1,1014722783,use `49oassc`; DELETE FROM `g_user` WHERE  g_user.g_name = 'aa123'



mysql-bin.000036,1014719592,Query,1,1014719706,use `49oassc`; DELETE FROM `g_panbiao` WHERE g_nid IN ('aa123')



mysql-bin.000036,1015423756,Query,1,1015423925,use `49oassc`; INSERT INTO g_c_log (name, page, date) VALUES ('admin','后台-新增代理下属会员',now())


mysql-bin.000036,1019080296,Query,1,1019080404,use `49oassc`; DELETE FROM g_zhudan WHERE g_nid = 'ceshi'





mysql-bin.000036,1014719592,Query,1,1014719706,use `49oassc`; DELETE FROM `g_panbiao` WHERE g_nid IN ('aa123')


mysql-bin.000036,1015422392,Query,1,1015422501,use `49oassc`; DELETE FROM g_zhudan WHERE g_nid = 'zh1234'



1014719592   1015422501



mysqlbinlog --no-defaults --start-position=1014719592 --stop-position=1015422501 mysql-bin.000036 > C:\\test1.sql



mysql -hlocalhost -uroot -pmzjl70522



source c://test1.sql

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册极酷会员

本版积分规则

快速回复 返回顶部 返回列表