Mysqlのインクリメンタルバックアップおよびポイント・イン・タイム・ポイント・ベースのリカバリ
# vim /etc/my.cnf
[mysql]
log-bin=mysql-bin // [mysql]
# systemctl restart mysqld //
( usr/local/mysql/data/ mysql-bin.000001 )
# mysqldump -u root -p school > /opt/school.sql // school
# mysqladmin -u root -p flush-logs //
( usr/local/mysql/data/ mysql-bin.000002 )
# mysqlbinlog --no-defaults --base64-output=decode-rows -v mysql-bin.000002
# mysqlbinlog --no-defaults mysql-bin.000001 | mysql -u root -p
( , )
# mysql -u root -p school < /opt/school.sql
# mysqlbinlog --no-defaults mysql-bin.000001 | mysql -u root -p
# mysqlbinlog --no-defaults mysql-bin.000002 | mysql -u root -p
( , )
# mysql -u root -p
> use school;
> drop table info;
# mysqldump -u root -p school > /opt/school.sql
# mysqlbinlog --no-defaults mysql-bin.000001 | mysql -u root -p
# mysqlbinlog --no-defaults mysql-bin.000002 | mysql -u root -p
# mysqlbinlog --no-defaults mysql-bin.000003 | mysql -u root -p
# mysqlbinlog --no-defaults mysql-bin.000004 | mysql -u root -p
# mysqlbinlog --no-defaults --stop-datetime='2018-07-03 18:19:49' /usr/local/mysql/data/mysql-bin.000005 | mysql -u root -p
# mysqlbinlog --no-defaults --start-datetime='2018-07-03 18:22:21' /usr/local/mysql/data/mysql-bin.000005 | mysql -u root -p
# mysqlbinlog --no-defaults --stop-position='347' /usr/local/mysql/data/mysql-bin.000005 | mysql -u root -p
# mysqlbinlog --no-defaults --start-position='395' /usr/local/mysql/data/mysql-bin.000005 | mysql -u root -p
転載先:https://blog.51cto.com/13630803/2135741