mysqlbinlog data recovery

1. Restore the specified time and dump the sql file

mysqlbinlog /var/lib/mysql/mysql-bin.000009 --start-datetime="2016-09-01 12:30:05" --stop-datetime="2016-09-01 17:41:28"  > /home/wen.du/1.sql

2. Extract the operation of the file specified table:

more 1.sql |grep  --ignore-case -E 'insert|update' -A2 -B2|grep user_path_loginroom > 2.sql

3. Add a ; sign after each line

sed 's/$/&;/g' 2.sql > 2-1.sql

 

 

mysqlbinlog /var/lib/mysql/mysql-bin.000009 --start-datetime="2016-08-22 12:30:05" --stop-datetime="2016-09-01 17:41:28" |mysql -uroot -p

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326679123&siteId=291194637