当前位置:   article > 正文

MySQL闪回工具之my2sql_共 my2sql 下载

共 my2sql 下载

my2sql

简介

go版MySQL binlog解析工具,通过解析MySQL binlog ,可以生成原始SQL、回滚SQL、去除主键的INSERT SQL等,也可以生成DML统计信息。https://github.com/liuhr/my2sql

安装

编译

git clone https://github.com/liuhr/my2sql.git
cd my2sql/
go build .
  • 1
  • 2
  • 3

也可以直接下载Linux版编译好的可执行文件
https://github.com/liuhr/my2sql/blob/master/releases/my2sql

应用案例

误删整张表数据,需要紧急回滚

mysql> #数据库
mysql> show create database testdb\G
*************************** 1. row ***************************
       Database: testdb
Create Database: CREATE DATABASE `testdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 */

mysql> #表结构
mysql> show create table student\G
*************************** 1. row ***************************
       Table: student
Create Table: CREATE TABLE `student` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `number` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `add_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加的时间',
  `content` json DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_name` (`number`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=utf8

mysql> #数据
mysql> select * from student;
+------+--------+---------+---------------------+---------------------------------+
| id   | number | name    | add_time            | content                         |
+------+--------+---------+---------------------+---------------------------------+
|   12 |     12 | che     | 2020-07-06 19:39:17 | NULL                            |
| 1217 |     12 | hanraan | 2020-07-06 19:39:17 | NULL                            |
| 1218 |     12 | NULL    | 2020-07-06 19:39:17 | NULL                            |
| 1219 |     12 | hanran  | 2020-07-06 19:39:17 | NULL                            |
| 1221 |     13 | hanran  | 2020-07-06 19:40:10 | NULL                            |
| 1222 |     14 | hanran  | 2020-07-06 19:42:17 | NU
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/955257
推荐阅读
相关标签
  

闽ICP备14008679号