1.首先确认误操作的位置
2.使用工具闪回
- [root@Yun-MySQL02 lib64]#/soft/mysqlbinlog -vv --start-position=331 -B --skip-gtids /databak/3306/mysql-bin.000043|/usr/local/mysql/bin/mysql -uroot -p`cat /etc/sqlpass ` -P3306 -h127.0.0.1 test
-
---如果开启了gtid的最好使用skip-gtids 不然会报错
[root@Yun-MySQL02 lib64]# /usr/local/mysql/bin/mysql -uroot -p`cat /etc/sqlpass ` -P3306 -h127.0.0.1 test
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1782 (HY000) at line 11: @@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON.
如果报
ERROR 1782 (HY000) at line 11: @@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON.
如果报
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
参考文档:https://www.aliyun.com/zixun/content/2_6_518744.html另外一个工具 binlog2sql
https://github.com/danfengcao/binlog2sql
-
binlog2sql 的一些改进:
-
在测试时--stop-never在qa环境没有作用,添加了在 BinLogStreamReader 实例里面加入 blocking=True 来保证源源不断的接受binlog而不中断。
-
-
另外也加入了更改目标库名的功能,比如原库叫d_my1,生成的sql目标库名是 d_my2 。
-
- http://seanlook.com/2017/09/05/mysql-binlog-subscribe-simple-for-dba/
其他参数参考:http://www.innomysql.com/article/25769.html