binlog2sql
1.下载binlog2sql
[root@localhost soft]#git clone https://github.com/danfengcao/binlog2sql.git
[root@localhost soft]#cd binlog2sql
[root@localhost soft]#pip3 install -r requirements.txt
我这里的python是3.6.5版本的,所以使用pip3安装
2.创建用户
grant select,replication slave,replication client on *.* to repl@'%' identified by 'mysql';
3.解析
[root@localhost binlog2sql]#cd /soft/binlog2sql/binlog2sql
[root@localhost binlog2sql]#python binlog2sql.py -h localhost -P13306 -urepl -pmysql -d db_test -t tb_test --start-file='binlog.000004';
说明:
--start-file 不能带绝对路径