Friday, August 27, 2010

Recover data from mysqlbinlog

if server crash and after restore mysqlbinlog not get recovered there is possibility of loosing data. still we can get important data with restoring from bin-log.

* Guess the the time of crash copy all bin-log files to separate folder ,in-case if you have backup of old date you need to select only those bin-log file having date after the dump taken .

* Run the command as such [better to go with one by one db recovery] .

/usr/local/mysql/bin/mysqlbinlog --database=pottytraining mysql-bin.000033 mysql-bin.000034>/opt/pottytraining.sql

* login to mysql prompt

mysql> use pottytraining;
mysql> source /opt/pottytraining.sql;


* Cool see the data.


Thanks

No comments: