my2sql 安装使用
1、安装
wget https://raw.githubusercontent.com/liuhr/my2sql/master/releases/centOS_release_7.x/my2sql chmod +x my2sql
2、分析在线binlog,正向解析SQL
./my2sql -user root -password a123456 -host 127.0.0.1 -port 3306 -mode repl -work-type 2sql -start-file mysql-bin.000009 -start-datetime "2022-07-16 10:20:00" -output-dir ./tmpdir
3、分析在线binlog,生成回滚SQL
./my2sql -user root -password a123456 -host 127.0.0.1 -port 3306 -mode repl -work-type rollback -start-file mysql-bin.000009 -start-datetime "2022-07-16 10:20:00" -output-dir ./tmpdir
4、分析已经离线binlog,生成回滚SQL
./my2sql -user root -password a123456 -host 127.0.0.1 -port 3306 -mode file -work-type 2sql -local-binlog-file /usr/local/mysql57/data/mysql-bin.000009 -start-file /usr/local/mysql57/data/mysql-bin.000038 -start-datetime "2020-07-16 10:20:00" -output-dir ./tmpdir
5、连接错误处理
需要使用mysql_native_password 并且配置文件中添加一行:
default_authentication_plugin =mysql_native_password
------道不行,乘桴浮于海!------
------欲讷于言,而敏于行!-------