MySQL5.6 解析 BinLog 生成SQL文件 原创 数据库 2022年9月27日 11:47 夏至未至 918 当前内容 1373 字,在路上,马上到,马上到 ### 目录 [TOC] ### 具体命令 /var/bin/mysqlbinlog /data/mysql-bin.000008 --start-datetime="2022-07-26 00:00:00" --stop-datetime="2022-07-27 15:00:00" -d testdb > /testdb.sql ### 命令解释 /var/bin/mysqlbinlog mysqlbinlog工具,即可执行程序 /data/mysql-bin.000008 bin文件的绝对路径,多个文件空格隔开 --start-position=240 指定记录的起始位置 --stop-position=958 指定记录的结束位置 --start-datetime="2022-07-26 00:00:00" 开始时间 (双引号) --stop-datetime="2022-07-27 15:00:00" 结束时间 (双引号) -d testdb 指定的数据库 > /testdb.sql 生成的sql文件的绝对路径 ### 执行生成的sql文件 [root@node1 ~]# mysql -uroot -p123456 -S /var/lib/mysql/mysql.sock Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.6.51 MySQL Community Server (GPL) Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> source /testdb.sql 本文标题: MySQL5.6 解析 BinLog 生成SQL文件 本文作者: 夏至未至 发布时间: 2022年9月27日 11:47 最近更新: 2022年9月27日 11:47 原文链接: 许可协议: 署名-非商业性-禁止演绎 4.0 国际(CC BY-NC-ND 4.0) 请按协议转载并保留原文链接及作者 MySQL(28) Binlog(2) 上一个 Kubernetes(k8s)入门、进阶学习资料 下一个 MySQL5.6重置root用户密码 当前文章评论暂未开放,请移步至留言处留言。