Backup and restore instructions
1 Fully prepared (the variables are password, port number, and output path. --compress supports compression)
mysqldump -uroot -p*** -P*** --single-transaction --master-data=2 --flush-logs --hex-blob --flush-privileges --triggers --routines --events --all-databases > ***
2 increments (1. Refresh binlog 2. Back up the logs between the last binlog switch <include> - the current binlog switch <exclusive>) (PS: The directory where the binlog is located is configured in my.cnf. If the log-bin If the value is mysql-bin, the datadir path is used)
mysql -uroot -p*** -P*** -e "flush logs;"
mysql -uroot -p*** -P*** -e "SHOW MASTER STATUS;" cp -pf ***/mysql-bin*** $MOUNT_DIR
3 Recovery (show processlist; status can be viewed)
drop database ***; --登录msql删除除了information_schema、mysql、performance_schema之外的其他库
mysql -uroot -p*** -P*** < $MOUNT_DIR/***.sql
mysqlbinlog $MOUNT_DIR/mysql-bin.*** | mysql -uroot -p*** -P***
mysqlbinlog $MOUNT_DIR/mysql-bin.*** | mysql -uroot -p*** -P***
....