{"id":390,"date":"2013-04-13T16:01:00","date_gmt":"2013-04-13T16:01:00","guid":{"rendered":"http:\/\/vickistan.com\/?p=390"},"modified":"2013-04-13T16:01:00","modified_gmt":"2013-04-13T16:01:00","slug":"mysqlbinlog-command","status":"publish","type":"post","link":"https:\/\/vickistan.com\/?p=390","title":{"rendered":"mysqlbinlog command"},"content":{"rendered":"<p>The &#8220;mysqlbinlog&#8221; command reads the binary logs and outputs them in SQL format. As a result, you can use it to create a database dump and then modify that file by hand. For example, let&#8217;s say that everything since April 10th, 10AM server time needs to be restored (leaving out one statement). We would first use this command:<\/p>\n<p>mysqlbinlog &#8211;start-datetime=&#8221;2013-04-10 10:0:00&#8243; \/var\/log\/mysql\/bin.123456 > output.sql<\/p>\n<p>to create the database dump. After this file is created, we can delete the offending statement that we would not want re-run. Alternately, if you know the specific binary log position, you can use the &#8211;start-position flag. Here are some articles on this process:<\/p>\n<p>http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/point-in-time-recovery.html<br \/>\nhttp:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/point-in-time-recovery-times.html<br \/>\nhttp:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/point-in-time-recovery-positions.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;mysqlbinlog&#8221; command reads the binary logs and outputs them in SQL format. As a result, you can use it to create a database dump and then modify that file by hand. For example, let&#8217;s say that everything since April &hellip; <a href=\"https:\/\/vickistan.com\/?p=390\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390"}],"version-history":[{"count":0,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions"}],"wp:attachment":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}