当前位置:网站首页>mysql通过binlog文件恢复数据
mysql通过binlog文件恢复数据
2022-04-23 14:00:00 【白云碎里一蓑舟】
-
将dump下来的压缩包解压到 /data/dumpback/目录下
tar -zxvf back_20220322.tar.gz -C /databak/data
-
进入mysql执行
#登录mysql mysql -uroot -p -S /data/mysql/mysql.sock #选择目标数据库 use zzz_test; #执行sql文件(定时备份的数据恢复完成 source /data/dumpback/data/mysql/20220322/zzz_test.sql
-
使用binlog日志将dump时间之后的数据恢复
#查看binlog日志开启状态(on为打开) show variables like 'log_bin'; #查询 BINLOG 格式 show VARIABLES like 'binlog_format'; #查看 master 正在写入的 BINLOG 信息 show master status\G; #退出mysql exit
#cat /etc/my.cnf 查看二进制日志存放目录 log_bin=/data/mysql/logs/mysql-bin
# 查看binlog文件(mysql重启一次,binlog文件名会变化一次 mysqlbinlog mysql-bin.000006
#根据时间区间将binlog文件转成.sql文件查看 /usr/bin/mysqlbinlog --no-defaults --database=zzz_test --base64-output=decode-rows -v --start-datetime='2022-03-25 09:39:10' --stop-datetime="2022-03-25 13:42:10" /var/lib/mysql/my-logbin.000069 >/databak/data/binlog.sql
#跟据时间执行二进制文件(恢复备份时间之后的数据内容 /usr/bin/mysqlbinlog --database=zzz_test --start-datetime='2022-03-25 13:53:29' --stop-datetime='2022-03-25 13:55:01' /var/lib/mysql/my-logbin.000069 | mysql -uroot -p123456
版权声明
本文为[白云碎里一蓑舟]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_49513507/article/details/123665551
边栏推荐
- JS force deduction brush question 103 Zigzag sequence traversal of binary tree
- [code analysis (2)] communication efficient learning of deep networks from decentralized data
- Function executes only the once function for the first time
- 专题测试05·二重积分【李艳芳全程班】
- Chapter 15 new technologies of software engineering
- 剑南春把文字游戏玩明白了
- 自动化的艺术
- leetcode--977. Squares of a Sorted Array
- scikit-learn构建模型的万能模板
- Analysis and understanding of atomicintegerarray source code
猜你喜欢
Express ② (routage)
SQL learning | set operation
Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design
2022年江西最新建筑八大员(质量员)模拟考试题库及答案解析
scikit-learn构建模型的万能模板
Wechat applet
编程旅行之函数
Detailed explanation of redis (Basic + data type + transaction + persistence + publish and subscribe + master-slave replication + sentinel + cache penetration, breakdown and avalanche)
Using Baidu Intelligent Cloud face detection interface to achieve photo quality detection
go 语言 数组,字符串,切片
随机推荐
elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)
美联储数字货币最新进展
Taobao released the baby prompt "your consumer protection deposit is insufficient, and the expiration protection has been started"
go 语言 数组,字符串,切片
Multithreading
Kettle--控件解析
MySQL [SQL performance analysis + SQL tuning]
L2-024 部落 (25 分)
第十五章 软件工程新技术
Express middleware ③ (custom Middleware)
_模_板_
Dynamic subset division problem
力扣刷题 101. 对称二叉树
[code analysis (5)] communication efficient learning of deep networks from decentralized data
The art of automation
JS 烧脑面试题大赏
Leetcode | 38 appearance array
Tensorflow Download
Reading notes: fedgnn: Federated graph neural network for privacy preserving recommendation
快捷键(多行)