MySQL full backup + incremental backup
- Profile:
- full backup: using mysqldump
mysqldump -F -uxxx -p --databases anheisg > /home/dw/backup/anheisg.sql
- -F means refreshing the Binlog log for incremental backups
- Incremental backup:
- Incremental backup data is obtained from the Binlog log
- Data recovery:
-
show master status;
View Binlog logs currently being written, such as mysql-bin.000005
- full backup restore
-
flush logs;
Writes the modifications of the database to the new Binlog log so that it is easy to view and process the mysql-bin.000005 - Incremental Backup Restore
- method One:
-
Show Binlog Events in ' mysql-bin.000005 ';
View POS and End_pos for error actions
-
mysqlbinlog--no-defaults/var/log/mysql/mysql_bin.000005--stop-position=878 | my Sql-uroot-p anheisg
- Restore an incremental backup using the Mysqlbinlog command,--start-position=xxx and--stop-position=xxx can specify the range of recovery
- Method Two:
-
mysqlbinlog--no-defaults/var/log/mysql/mysql_bin.000005-d ANHEISG > Anheihei.sql
- Delete the misoperation command in the exported SQL file and restore it
-
mysql-udw-pxxx ANHEISG < Anheih Ei.sql
MySQL full backup + incremental backup