一些命令
#刷新日志(此刻开始产生一个新编号的binlog文件)
FLUSH LOGS;
#清空日志(++!!!!!删除所有日志文件,并将文件名和记录点进行重置归零,99%的情况下是用不到这条命令的++)
RESET MASTER
#用于删除列于在指定的日志或日期之前的日志索引中的所有二进制日志
URGE {MASTER | BINARY} LOGS TO 'log_name'
PURGE {MASTER | BINARY} LOGS BEFORE 'date'
PURGE MASTER LOGS TO 'mysql-bin.010';
PURGE MASTER LOGS BEFORE '2003-04-02 22:46:26';
#mysqlbinlog --help
#
base64-output (No default value)
bind-address (No default value)
character-sets-dir (No default value)
database (No default value)
debug-check FALSE
debug-info FALSE
default-auth (No default value)
disable-log-bin FALSE
force-if-open TRUE
force-read FALSE
hexdump FALSE
host (No default value)
local-load (No default value)
offset 0
plugin-dir (No default value)
port 3306
read-from-remote-server FALSE
read-from-remote-master (No default value)
raw FALSE
result-file (No default value)
secure-auth TRUE
server-id 0
server-id-bits 32
set-charset (No default value)
short-form FALSE
socket /tmp/mysql.sock
start-datetime (No default value)
start-position 4
stop-datetime (No default value)
stop-never FALSE
stop-never-slave-server-id -1
stop-position 18446744073709551615
to-last-log FALSE
user (No default value)
open-files-limit 64
verify-binlog-checksum FALSE
binlog-row-event-max-size 4294967040
skip-gtids FALSE
include-gtids (No default value)
exclude-gtids (No default value)
1.根据position 处理
mysqlbinlog mysql-bin.000001 -d xntg --start-position=4 --stop-position=2452965 > test1.sql
2.根据time处理
mysqlbinlog mysql-bin.000001 -d xntg --start-datetime="2020-01-12 15:00:51" > test2.sql
mysqlbinlog mysql-bin.000001 -d xntg --start-datetime="2020-01-12 15:00:51" --stop-datetime="2020-01-12 15:10:51" > test2.sql
3.直接导入
mysqlbinlog --start-datetime="2018-04-27 20:57:55" --stop-datetime="2018-04-27 20:58:18" --database=hello /var/lib/mysql/mysql-bin.000009 | mysql -uroot -ptest -v hello
### 注意全量备份时间、增量binlog时间! ####
1.先导入全量备份数据
2.导入增量binlog数据