參考原文: https://github.com/danfengcao/binlog2sql.gitpython
# vim /etc/my.cnf [mysqld] server-id = 1 log_bin = /var/log/mysql/mysql-bin.log
# git clone https://github.com/danfengcao/binlog2sql.git # cd binlog2sql # pip install -r requirements.txt
> SHOW BINARY LOGS; > SHOW MASTER LOGS; > SHOW MASTER STATUS;
# python binlog2sql/binlog2sql.py -h127.0.0.1 -P3306 -uroot -p'123456' -dc_test -tc_dict_info --start-file='mysql-bin.000004'
# python binlog2sql/binlog2sql.py -h127.0.0.1 -P3306 -uroot -p'123456' -dc_test -tc_dict_info --start-file='mysql-bin.000004' --start-pos=16723 --end-pos=17734 -B