title: Recover lost mysql data
body: <p>I accidentally executed a sql script that dropped all the tables of my database. The good thing is I have a master slave replication set-up but my slave hasn't been updated for the past 7 days. </p>
  
  <p>So I was thinking if I can rollback the binlogs position to <em>undo</em> the changes made by the script.</p>
  
  <p>Running <code>SHOW BINARY LOGS;</code> gave me:</p>
  
  <pre><code>"Log_name"  "File_size"
  "mst-bin.000001"    "1073883720"
  "mst-bin.000002"    "1073742741"
  "mst-bin.000003"    "1073743121"
  "mst-bin.000004"    "1073744456"
  "mst-bin.000005"    "1073742926"
  "mst-bin.000006"    "1073744758"
  "mst-bin.000007"    "1073741932"
  "mst-bin.000008"    "1073742250"
  "mst-bin.000009"    "1073741889"
  "mst-bin.000010"    "1073745312"
  "mst-bin.000011"    "1073742485"
  "mst-bin.000012"    "1073743060"
  "mst-bin.000013"    "316454512"
  "mst-bin.000014"    "1073744018"
  "mst-bin.000015"    "1073741967"
  "mst-bin.000016"    "1073741933"
  "mst-bin.000017"    "1073742186"
  "mst-bin.000018"    "828840943" // i believe this is the affected binlog
  </code></pre>
  
  <p>What are my options here? After running the script I immediately disabled the database server to freeze everything.</p>
  
  <hr>
  
  <p>I tried  <code>./mysqlbinlog.exe --start-datetime="2017-02-21 12:01:57" ../data/mst-bin.000018</code> which is the time the script got executed and I saw everything the script executed.</p>
  
  <p>The last position right before the script started executing drops has this info:</p>
  
  <pre><code># at 828841094
  #170221 12:06:15 server id 1  end_log_pos 828841169     Query   thread_id=66    exec_time=0     error_code=0
  </code></pre>