当前位置:网站首页>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
边栏推荐
- Question bank and answer analysis of the 2022 simulated examination of the latest eight members of Jiangxi construction (quality control)
- Android篇:2019初中级Android开发社招面试解答(中
- Force deduction brush question 101 Symmetric binary tree
- How does redis solve the problems of cache avalanche, cache breakdown and cache penetration
- STM32 learning record 0007 - new project (based on register version)
- L2-024 部落 (25 分)
- Quartus Prime硬件实验开发(DE2-115板)实验二功能可调综合计时器设计
- MySQL index [data structure + index creation principle]
- 2021年秋招,薪资排行NO
- Get the attribute value difference between two different objects with reflection and annotation
猜你喜欢
Nacos+AspnetCore+Ocelot实战编码
freeCodeCamp----arithmetic_ Arranger exercise
Interesting talk about network protocol
蓝绿发布、滚动发布、灰度发布,有什么区别?
程序编译调试学习记录
Solution of discarding evaluate function in surprise Library
Business case | how to promote the activity of sports and health app users? It is enough to do these points well
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
Dynamic subset division problem
Small case of web login (including verification code login)
随机推荐
程序编译调试学习记录
Pytorch 经典卷积神经网络 LeNet
Choreographer full resolution
Interesting talk about network protocol
Basic knowledge learning record
1256: bouquet for algenon
Express ② (routage)
leetcode--380.O(1) 时间插入、删除和获取随机元素
freeCodeCamp----time_ Calculator exercise
What is the difference between blue-green publishing, rolling publishing and gray publishing?
村上春树 --《当我谈跑步时,我谈些什么》句子摘录
Reading notes: fedgnn: Federated graph neural network for privacy preserving recommendation
Haruki Murakami -- Excerpt from "what do I talk about when I talk about running"
Use future and countdownlatch to realize multithreading to execute multiple asynchronous tasks, and return results after all tasks are completed
Kettle--控件解析
MySQL [SQL performance analysis + SQL tuning]
2021年秋招,薪资排行NO
变长参数__VA_ARGS__ 和 写日志的宏定义
生成随机高质量符合高斯分布的随机数
Reading notes: meta matrix factorization for federated rating predictions