my2sql-binlog闪回测试

测试my2sql-binlog闪回

环境:

测试数据库服务器:192.168.1.33

测试闪回服务器:192.168.1.33

一、编译安装my2sql源码包(闪回服务器)

1.下载my2sql源码包

https://github.com/liuhr/my2sql

2.安装go语言环境

root@mysql-master \~\]# yum install -y golang \[root@mysql-master \~\]# go version ### 3.编译安装源码包 \[root@mysql-master \~\]# unzip my2sql-master.zip \[root@mysql-master \~\]# mv my2sql-master my2sql \[root@mysql-master \~\]# mv my2sql /app/ \[root@mysql-master \~\]# cd /app/my2sql/ \[root@mysql-master my2sql\]# go mod tidy ##下载依赖 ##若报错,配置代理 \[root@mysql-master my2sql\]# go env -w GOPROXY=[https://goproxy.cn,direct](https://goproxy.cn,direct/ "https://goproxy.cn,direct") 重新执行go mod tidy \[root@mysql-master my2sql\]# go build -o my2sql ### 4.配置环境变量 \[root@mysql-master my2sql\]# vim /root/.bashrc export PATH=$[PATH:/app/my2sql](http://path/app/my2sql "PATH:/app/my2sql") \[root@mysql-master my2sql\]# source /root/.bashrc \[root@mysql-master my2sql\]# cd \[root@mysql-master \~\]# my2sql -v my2sql V2.0 ## 二、创建恢复账号(数据库服务器) (8.0版本(指定密码认证)) CREATE USER \`rollback_admin\`@\`192.168.1.33\` IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'pwd'; GRANT SELECT, REPLICATION SLAVE,REPLICATION CLIENT ON \*.\* TO \`rollback_admin\`@\`192.168.1.33\`; 此处指定只有192.168.1.33 服务器拥有此数据库登录权限! 测试数据库: test01 测试表: employee mysql\> select \* from test01.employee; +----+--------------+--------+------+------------+--------------------------+------------+----------+-------------+ \| id \| name \| gender \| age \| department \| position \| hire_date \| salary \| phone \| +----+--------------+--------+------+------------+--------------------------+------------+----------+-------------+ \| 1 \| 张三 \| 男 \| 28 \| 研发部 \| 后端工程师 \| 2020-03-15 \| 15000.00 \| 13800138001 \| \| 2 \| 李四 \| 女 \| 32 \| 销售部 \| 销售经理 \| 2018-07-20 \| 18000.00 \| 13900139002 \| \| 3 \| 王五 \| 男 \| 35 \| 财务部 \| 财务主管 \| 2017-01-10 \| 20000.00 \| 13700137003 \| \| 4 \| 赵六 \| 女 \| 25 \| 人事部 \| 招聘专员 \| 2021-05-05 \| 12000.00 \| 13600136004 \| \| 5 \| 孙七 \| 男 \| 30 \| 研发部 \| 前端工程师 \| 2019-11-22 \| 14000.00 \| 13500135005 \| \| 6 \| 周八 \| 女 \| 29 \| 市场部 \| 策划专员 \| 2020-08-18 \| 13000.00 \| 13400134006 \| \| 7 \| 吴九 \| 男 \| 40 \| 管理层 \| 技术总监 \| 2015-03-01 \| 35000.00 \| 13300133007 \| \| 8 \| 郑十 \| 女 \| 27 \| 客服部 \| 客服主管 \| 2022-01-12 \| 11000.00 \| 13200132008 \| \| 9 \| 钱十一 \| 男 \| 33 \| 研发部 \| 测试工程师 \| 2018-09-30 \| 16000.00 \| 13100131009 \| \| 10 \| 冯十二 \| 女 \| 31 \| 销售部 \| 销售代表 \| 2019-05-15 \| 14500.00 \| 13000130010 \| \| 11 \| 陈十三 \| 男 \| 29 \| 研发部 \| 算法工程师 \| 2019-08-20 \| 18000.00 \| 15800158001 \| \| 12 \| 杨十四 \| 女 \| 26 \| 销售部 \| 大客户专员 \| 2022-03-10 \| 13500.00 \| 15900159002 \| \| 13 \| 黄十五 \| 男 \| 36 \| 财务部 \| 税务专员 \| 2016-11-05 \| 17000.00 \| 15700157003 \| \| 14 \| 刘十六 \| 女 \| 24 \| 人事部 \| 薪酬专员 \| 2023-01-18 \| 11500.00 \| 15600156004 \| \| 15 \| 林十七 \| 男 \| 31 \| 研发部 \| DevOps工程师 \| 2020-07-30 \| 16500.00 \| 15500155005 \| \| 16 \| 何十八 \| 女 \| 30 \| 市场部 \| 品牌经理 \| 2019-04-22 \| 19000.00 \| 15400154006 \| \| 17 \| 郭十九 \| 男 \| 42 \| 管理层 \| 产品总监 \| 2014-09-15 \| 38000.00 \| 15300153007 \| \| 18 \| 马二十 \| 女 \| 27 \| 客服部 \| 售后专员 \| 2022-06-08 \| 10500.00 \| 15200152008 \| \| 19 \| 朱二十一 \| 男 \| 34 \| 研发部 \| 数据工程师 \| 2018-03-25 \| 17500.00 \| 15100151009 \| \| 20 \| 胡二十二 \| 女 \| 32 \| 销售部 \| 渠道经理 \| 2017-12-12 \| 21000.00 \| 15000150010 \| \| 21 \| 罗二十三 \| 男 \| 30 \| 研发部 \| 前端架构师 \| 2018-06-30 \| 22000.00 \| 18800188001 \| \| 22 \| 高二十四 \| 女 \| 28 \| 人事部 \| 培训经理 \| 2019-08-15 \| 16000.00 \| 18900189002 \| \| 23 \| 梁二十五 \| 男 \| 37 \| 财务部 \| 财务总监 \| 2015-05-20 \| 28000.00 \| 18700187003 \| \| 24 \| 宋二十六 \| 女 \| 25 \| 市场部 \| 新媒体运营 \| 2023-03-10 \| 12500.00 \| 18600186004 \| \| 25 \| 郑二十七 \| 男 \| 33 \| 研发部 \| 后端架构师 \| 2017-11-05 \| 25000.00 \| 18500185005 \| \| 26 \| 谢二十八 \| 女 \| 31 \| 销售部 \| 区域经理 \| 2018-12-20 \| 20000.00 \| 18400184006 \| \| 27 \| 韩二十九 \| 男 \| 45 \| 管理层 \| 技术副总裁 \| 2013-02-18 \| 45000.00 \| 18300183007 \| \| 28 \| 唐三十 \| 女 \| 26 \| 客服部 \| 客服总监 \| 2021-09-01 \| 15000.00 \| 18200182008 \| \| 29 \| 冯三十一 \| 男 \| 35 \| 研发部 \| AI工程师 \| 2016-07-12 \| 24000.00 \| 18100181009 \| \| 30 \| 于三十二 \| 女 \| 29 \| 销售部 \| 销售助理 \| 2020-04-05 \| 13000.00 \| 18000180010 \| \| 31 \| 董三十三 \| 男 \| 32 \| 研发部 \| 全栈工程师 \| 2017-09-25 \| 20000.00 \| 17800178001 \| \| 32 \| 袁三十四 \| 女 \| 27 \| 人事部 \| 员工关系专员 \| 2022-05-10 \| 14000.00 \| 17900179002 \| \| 33 \| 许三十五 \| 男 \| 38 \| 管理层 \| 运营总监 \| 2014-08-18 \| 32000.00 \| 17700177003 \| \| 34 \| 邓三十六 \| 女 \| 26 \| 市场部 \| 活动策划 \| 2023-06-01 \| 13000.00 \| 17600176004 \| \| 35 \| 沈三十七 \| 男 \| 34 \| 财务部 \| 审计专员 \| 2018-11-30 \| 19000.00 \| 17500175005 \| \| 36 \| 彭三十八 \| 男 \| 31 \| 研发部 \| 区块链工程师 \| 2020-03-18 \| 23000.00 \| 16800168001 \| \| 37 \| 吕三十九 \| 女 \| 28 \| 市场部 \| 内容运营 \| 2022-08-25 \| 14500.00 \| 16900169002 \| \| 38 \| 苏四十 \| 男 \| 39 \| 管理层 \| 财务副总裁 \| 2013-10-01 \| 42000.00 \| 16700167003 \| \| 39 \| 卢四十一 \| 女 \| 25 \| 客服部 \| 智能客服专员 \| 2023-02-15 \| 12000.00 \| 16600166004 \| \| 40 \| 蒋四十二 \| 男 \| 36 \| 研发部 \| 大数据开发工程师 \| 2017-05-22 \| 26000.00 \| 16500165005 \| \| 41 \| 蔡四十三 \| 男 \| 30 \| 研发部 \| 前端开发工程师 \| 2019-04-10 \| 17000.00 \| 19800198001 \| \| 42 \| 贾四十四 \| 女 \| 27 \| 人事部 \| 招聘经理 \| 2021-06-20 \| 15500.00 \| 19900199002 \| \| 43 \| 丁四十五 \| 男 \| 38 \| 财务部 \| 资金专员 \| 2015-09-05 \| 18500.00 \| 19700197003 \| \| 44 \| 魏四十六 \| 女 \| 26 \| 市场部 \| 品牌策划 \| 2023-01-15 \| 13500.00 \| 19600196004 \| \| 45 \| 薛四十七 \| 男 \| 34 \| 研发部 \| 后端开发工程师 \| 2018-11-25 \| 21000.00 \| 19500195005 \| \| 46 \| 叶四十八 \| 女 \| 32 \| 销售部 \| 大客户经理 \| 2017-08-30 \| 22000.00 \| 19400194006 \| \| 47 \| 阎四十九 \| 男 \| 43 \| 管理层 \| 技术总监 \| 2014-03-12 \| 39000.00 \| 19300193007 \| \| 48 \| 余五十 \| 女 \| 28 \| 客服部 \| 客服专员 \| 2022-04-20 \| 11000.00 \| 19200192008 \| \| 49 \| 潘五十一 \| 男 \| 35 \| 研发部 \| 算法研究员 \| 2016-12-08 \| 24000.00 \| 19100191009 \| \| 50 \| 杜五十二 \| 女 \| 31 \| 销售部 \| 销售助理 \| 2020-02-18 \| 14000.00 \| 19000190010 \| +----+--------------+--------+------+------------+--------------------------+------------+----------+-------------+ 50 rows in set (0.00 sec) ## 三、进行binlog闪回测试: ### 1.检查binlog信息 mysql\> show master status \\G \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* File: mysql-bin.000004 Position: 237 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: 69b0a5f9-5632-11f0-9e4b-000c293272b2:1-13, d5ba059c-562e-11f0-a820-000c293272b2:1-20 1 row in set (0.00 sec) mysql\> show master status; +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ \| File \| Position \| Binlog_Do_DB \| Binlog_Ignore_DB \| Executed_Gtid_Set \| +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ \| mysql-bin.000004 \| 237 \| \| \| 69b0a5f9-5632-11f0-9e4b-000c293272b2:1-13, d5ba059c-562e-11f0-a820-000c293272b2:1-20 \| +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) ### 2.模拟误删操作 mysql\> use test01; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A mysql\> SELECT COUNT(\*) FROM test01.employee; ##查询行数 +----------+ \| COUNT(\*) \| +----------+ \| 50 \| +----------+ 1 row in set (0.00 sec) Database changed mysql\> DELETE FROM employee WHERE age \> 35; Query OK, 10 rows affected (0.01 sec) mysql\> SELECT COUNT(\*) FROM test01.employee; +----------+ \| COUNT(\*) \| +----------+ \| 40 \| +----------+ 1 row in set (0.00 sec) mysql\> select now(); ##记录时间 +---------------------+ \| now() \| +---------------------+ \| 2025-07-16 13:42:36 \| +---------------------+ 1 row in set (0.01 sec) ### 3.查看binlog文件 mysql\> show master status; +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ \| File \| Position \| Binlog_Do_DB \| Binlog_Ignore_DB \| Executed_Gtid_Set \| +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ \| mysql-bin.000004 \| 1302 \| \| \| 69b0a5f9-5632-11f0-9e4b-000c293272b2:1-14, d5ba059c-562e-11f0-a820-000c293272b2:1-20 \| +------------------+----------+--------------+------------------+--------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) ### 4.binlog解析日志 \[root@mysql-master \~\]# cd /data/mysql-8.0.40/my3306/data/ \[root@mysql-master data\]# 使用直接生成sql的方式 \[root@mysql-master data\]# mysqlbinlog mysql-bin.000004 --start-datetime='2025-07-16 13:35:36' --stop-datetime='2025-07-16 13:50:36' --base64-output=decode-rows -v \> /tmp/tmp_employee.sql ##此处应指定表名,方便找到想要的信息 \[root@mysql-master data\]# cat /tmp/tmp_employee.sql # The proper term is pseudo_replica_mode, but we use this compatibility alias # to make the statement usable on server versions 8.0.24 and older. /\*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1\*/; /\*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0\*/; DELIMITER /\*!\*/; # at 4 #250716 13:29:15 server id 1333306 end_log_pos 126 CRC32 0x9fd02f40 Start: binlog v 4, server v 8.0.40 created 250716 13:29:15 at startup # Warning: this binlog is either in use or was not closed properly. ROLLBACK/\*!\*/; # at 237 #250716 13:44:08 server id 1333306 end_log_pos 316 CRC32 0x880e8055 GTID last_committed=0 sequence_number=1 rbr_only=yes original_committed_timestamp=1752644648170291 immediate_commit_timestamp=1752644648170291 transaction_length=1065 /\*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED\*//\*!\*/; # original_commit_timestamp=1752644648170291 (2025-07-16 13:44:08.170291 CST) # immediate_commit_timestamp=1752644648170291 (2025-07-16 13:44:08.170291 CST) /\*!80001 SET @@session.original_commit_timestamp=1752644648170291\*//\*!\*/; /\*!80014 SET @@session.original_server_version=80040\*//\*!\*/; /\*!80014 SET @@session.immediate_server_version=80040\*//\*!\*/; SET @@SESSION.GTID_NEXT= '69b0a5f9-5632-11f0-9e4b-000c293272b2:14'/\*!\*/; # at 316 #250716 13:44:08 server id 1333306 end_log_pos 393 CRC32 0xd55a2d15 Query thread_id=9 exec_time=0 error_code=0 SET TIMESTAMP=1752644648/\*!\*/; SET @@session.pseudo_thread_id=9/\*!\*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/\*!\*/; SET @@session.sql_mode=1168113664/\*!\*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/\*!\*/; /\*!\\C utf8mb4 \*//\*!\*/; SET @@session.character_set_client=255,@@session.collation_connection=255,@@session.collation_server=45/\*!\*/; SET @@session.lc_time_names=0/\*!\*/; SET @@session.collation_database=DEFAULT/\*!\*/; /\*!80011 SET @@session.default_collation_for_utf8mb4=255\*//\*!\*/; BEGIN /\*!\*/; # at 393 # at 452 #250716 13:44:08 server id 1333306 end_log_pos 532 CRC32 0x3ee493e0 Table_map: \`test01\`.\`employee\` mapped to number 89 # has_generated_invisible_primary_key=0 # at 532 #250716 13:44:08 server id 1333306 end_log_pos 1271 CRC32 0xdc77dcf2 Delete_rows: table id 89 flags: STMT_END_F ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=7 ### @2='吴九' ### @3='男' ### @4=40 ### @5='管理层' ### @6='技术总监' ### @7='2015:03:01' ### @8=35000.00 ### @9='13300133007' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=13 ### @2='黄十五' ### @3='男' ### @4=36 ### @5='财务部' ### @6='税务专员' ### @7='2016:11:05' ### @8=17000.00 ### @9='15700157003' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=17 ### @2='郭十九' ### @3='男' ### @4=42 ### @5='管理层' ### @6='产品总监' ### @7='2014:09:15' ### @8=38000.00 ### @9='15300153007' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=23 ### @2='梁二十五' ### @3='男' ### @4=37 ### @5='财务部' ### @6='财务总监' ### @7='2015:05:20' ### @8=28000.00 ### @9='18700187003' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=27 ### @2='韩二十九' ### @3='男' ### @4=45 ### @5='管理层' ### @6='技术副总裁' ### @7='2013:02:18' ### @8=45000.00 ### @9='18300183007' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=33 ### @2='许三十五' ### @3='男' ### @4=38 ### @5='管理层' ### @6='运营总监' ### @7='2014:08:18' ### @8=32000.00 ### @9='17700177003' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=38 ### @2='苏四十' ### @3='男' ### @4=39 ### @5='管理层' ### @6='财务副总裁' ### @7='2013:10:01' ### @8=42000.00 ### @9='16700167003' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=40 ### @2='蒋四十二' ### @3='男' ### @4=36 ### @5='研发部' ### @6='大数据开发工程师' ### @7='2017:05:22' ### @8=26000.00 ### @9='16500165005' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=43 ### @2='丁四十五' ### @3='男' ### @4=38 ### @5='财务部' ### @6='资金专员' ### @7='2015:09:05' ### @8=18500.00 ### @9='19700197003' ### DELETE FROM \`test01\`.\`employee\` ### WHERE ### @1=47 ### @2='阎四十九' ### @3='男' ### @4=43 ### @5='管理层' ### @6='技术总监' ### @7='2014:03:12' ### @8=39000.00 ### @9='19300193007' # at 1271 #250716 13:44:08 server id 1333306 end_log_pos 1302 CRC32 0xcbea17e6 Xid = 22 COMMIT/\*!\*/; SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /\* added by mysqlbinlog \*/ /\*!\*/; DELIMITER ; # End of log file /\*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE\*/; /\*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0\*/; ### 5.根据操作时间解析binlog,同时确认误操作时间节点范围,生成回滚SQL语句 创建目录: \[root@mysql-master \~\]# mkdir /app/my2sql/flash_back 使用时间戳: my2sql -user rollback_admin -password pwd -port 3306 \\ -host 192.168.1.33 -databases test01 -tables employee \\ -work-type rollback -start-file mysql-bin.000004 \\ -start-datetime "2025-07-16 13:35:36" -stop-datetime "2025-07-16 13:50:36" \\ -output-dir /app/my2sql/flash_back \[root@mysql-master \~\]# my2sql -user rollback_admin -password pwd -port 3306 \\ -host 192.168.1.33 -databases test01 -tables employee \\ -work-type rollback -start-file mysql-bin.000004 \\ -start-datetime "2025-07-16 13:35:36" -stop-datetime "2025-07-16 13:50:36" \\ -output-dir /app/my2sql/flash_back \[2025/07/16 14:35:14\] \[info\] binlogsyncer.go:164 create BinlogSyncer with config {1113306 mysql 192.168.1.33 3306 rollback_admin utf8 false false \ false Local false 0 0s 0s 0 false false 0 \ 0xc0000ae000 0x620d80} \[2025/07/16 14:35:14\] \[info\] events.go:221 start thread to write redo/rollback sql into file \[2025/07/16 14:35:14\] \[info\] binlogsyncer.go:400 begin to sync binlog from position (mysql-bin.000004, 4) \[2025/07/16 14:35:14\] \[info\] stats_process.go:166 start thread to analyze statistics from binlog \[2025/07/16 14:35:14\] \[info\] events.go:61 start thread 1 to generate redo/rollback sql \[2025/07/16 14:35:14\] \[info\] events.go:61 start thread 2 to generate redo/rollback sql \[2025/07/16 14:35:14\] \[info\] repl.go:16 start to get binlog from mysql \[2025/07/16 14:35:14\] \[info\] binlogsyncer.go:816 rotate to (mysql-bin.000004, 4) \[2025/07/16 14:35:19\] \[info\] repl.go:84 deadline exceeded. \[2025/07/16 14:35:19\] \[info\] repl.go:18 finish getting binlog from mysql \[2025/07/16 14:35:19\] \[info\] stats_process.go:266 exit thread to analyze statistics from binlog \[2025/07/16 14:35:19\] \[info\] events.go:196 exit thread 1 to generate redo/rollback sql \[2025/07/16 14:35:19\] \[info\] events.go:196 exit thread 2 to generate redo/rollback sql \[2025/07/16 14:35:19\] \[info\] events.go:270 finish writing rollback sql into tmp files, start to revert content order of tmp files \[2025/07/16 14:35:19\] \[info\] rollback_process.go:15 start thread 1 to revert rollback sql files \[2025/07/16 14:35:19\] \[info\] rollback_process.go:41 start to revert tmp file /app/my2sql/flash_back/.rollback.4.sql into /app/my2sql/flash_back/rollback.4.sql \[2025/07/16 14:35:19\] \[info\] rollback_process.go:156 finish reverting tmp file /app/my2sql/flash_back/.rollback.4.sql into /app/my2sql/flash_back/rollback.4.sql \[2025/07/16 14:35:19\] \[info\] rollback_process.go:25 exit thread 1 to revert rollback sql files \[2025/07/16 14:35:19\] \[info\] events.go:283 finish reverting content order of tmp files \[2025/07/16 14:35:19\] \[info\] events.go:288 exit thread to write redo/rollback sql into file ### 6.查看生成回滚的sql \[root@mysql-master \~\]# cd /app/my2sql/flash_back/ \[root@mysql-master flash_back\]# ll 总用量 12 -rw-r--r-- 1 root root 259 7月 16 14:35 biglong_trx.txt -rw-r--r-- 1 root root 288 7月 16 14:35 binlog_status.txt -rw-r--r-- 1 root root 2162 7月 16 14:35 rollback.4.sql ### 7.查看DML信息(验证回滚范围的准确性、回滚 SQL 的有效性) \[root@mysql-master flash_back\]# cat biglong_trx.txt binlog starttime stoptime startpos stoppos rows duration tables mysql-bin.000004 2025-07-16_13:44:08 2025-07-16_13:44:08 316 1302 10 0 \[test01.employee(inserts=0, updates=0, deletes=10)

root@mysql-master flash_back\]# cat binlog_status.txt binlog starttime stoptime startpos stoppos inserts updates deletes database table mysql-bin.000004 2025-07-16_13:44:08 2025-07-16_13:44:08 452 1271 0 0 10 test01 employee ### 8.查看回滚sql \[root@mysql-master flash_back\]# cat rollback.4.sql INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (47,'阎四十九','男',43,'管理层','技术总监','2014-03-12','39000.00','19300193007'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (43,'丁四十五','男',38,'财务部','资金专员','2015-09-05','18500.00','19700197003'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (40,'蒋四十二','男',36,'研发部','大数据开发工程师','2017-05-22','26000.00','16500165005'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (38,'苏四十','男',39,'管理层','财务副总裁','2013-10-01','42000.00','16700167003'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (33,'许三十五','男',38,'管理层','运营总监','2014-08-18','32000.00','17700177003'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (27,'韩二十九','男',45,'管理层','技术副总裁','2013-02-18','45000.00','18300183007'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (23,'梁二十五','男',37,'财务部','财务总监','2015-05-20','28000.00','18700187003'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (17,'郭十九','男',42,'管理层','产品总监','2014-09-15','38000.00','15300153007'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (13,'黄十五','男',36,'财务部','税务专员','2016-11-05','17000.00','15700157003'); INSERT INTO \`test01\`.\`employee\` (\`id\`,\`name\`,\`gender\`,\`age\`,\`department\`,\`position\`,\`hire_date\`,\`salary\`,\`phone\`) VALUES (7,'吴九','男',40,'管理层','技术总监','2015-03-01','35000.00','13300133007'); ### 8.测试更新恢复 使用有写入权限的账户恢复 \[root@mysql-master \~\]# mysql -uroot --socket=/data/mysql-8.0.40/my3306/tmp/mysql3306.sock -ptravelsky_admin@hx_2025 test01 \< /app/my2sql/flash_back/rollback.4.sql mysql: \[Warning\] Using a password on the command line interface can be insecure. mysql\> SELECT COUNT(\*) FROM test01.employee; +----------+ \| COUNT(\*) \| +----------+ \| 50 \| +----------+ 1 row in set (0.00 sec) 测试恢复成功!!!

相关推荐
叁沐14 分钟前
MySQL 16“order by”是怎么工作的?
mysql
lzhailb1 小时前
第三次mysql作业
数据库·mysql
蒟蒻的工具人1 小时前
MySQL学习——面试版
学习·mysql·面试
小张快跑。2 小时前
【Java入门到精通】(五)初识MySql数据库
java·数据库·mysql
kfepiza2 小时前
Debian-10,用glibc二进制预编译包,安装Mysql-5.7.44 笔记250716
mysql·debian
搬码临时工2 小时前
外网如何连接内网中的mysql数据库服务?跨网直接访问操作,不用公网IP
数据库·tcp/ip·mysql
ApacheSeaTunnel3 小时前
MySQL 数据同步至 S3file,并接入 Hive 访问:SeaTunnel 实践指南
大数据·mysql·开源·数据集成·s3·seatunnel·数据同步
wjpwjpwjp08313 小时前
[MySQL基础1]数据定义语言DDL与数据操作语言DML
数据库·笔记·mysql·oracle
gorgor在码农3 小时前
基于Canal实现MySQL数据库数据同步
数据库·mysql·canal·数据库数据同步工具
孤的心了不冷4 小时前
【后端】配置SqlSugar ORM框架并添加仓储
mysql·sqlserver·.netcore