当前位置:网站首页>MySQL data loss, analyze binlog log file
MySQL data loss, analyze binlog log file
2022-07-07 04:02:00 【Little snail's way】
scene : A part of the business data that should exist is found missing in the test environment
a Table related b Table business data includes 28 The data of , however a The watch doesn't , late mysql Log view reason !
Belonging to account general_log The directory where the files are stored
mysql> SHOW VARIABLES LIKE 'gen%';
+----------------------------------+----------------------------+
| Variable_name | Value |
+----------------------------------+----------------------------+
| general_log | OFF |
| general_log_file | /var/lib/mysql/server6.log |
| generated_random_password_length | 20 |
+----------------------------------+----------------------------+
3 rows in set (0.01 sec)
Then you can go to the corresponding general_log Go to the directory to see the execution log .
see binlog
Command line login database :mysql -uroot -p123456
show binary logs;
mysql> show binary logs
-> ;
+---------------+-----------+-----------+
| Log_name | File_size | Encrypted |
+---------------+-----------+-----------+
| binlog.000001 | 385141819 | No |
+---------------+-----------+-----------+
If you need to query 2022-06-28 00:00:00 To 2022-06-28 23:59:50 The database for test Operation log of , Enter the following command to write the data to a standby txt that will do
mysqlbinlog --no-defaults --database=test --base64-output=decode-rows -v --start-datetime="2022-06-28 00:00:00" --stop-datetime="2022-06-28 23:59:50" binlog.000001 > test.txt;
--base64-output=decode-rows -v
Parameters :
- base64-output, You can control the output of the output statement base64 Coded BINLOG sentence ;
- decode-rows: Option will decode the row based event into a SQL sentence
adopt vi command ,/ keyword Query correlation sql
Pictured :
Check the log , It turns out that the table is in 29 Japan 9:55:41 Seconds were deleted and recreated , All business data is lost !!!
Binlog Analytical skills
- Try to parse from the library , Avoid affecting the main library
- First, roughly locate the related library table operations binlog, Then analyze the corresponding binlog Data in
- In parsing DDL There is no need to add
-v
Output details ( Speed up parsing ) - If it's on
binlog_rows_query_log_events
Parameters , Need to use-vv
Parameters can display specific SQL sentence
边栏推荐
- 什么是 BA ?BA怎么样?BA和BI是什么关系?
- 手机号国际区号JSON格式另附PHP获取
- 二进制、八进制、十六进制
- Implementation steps of docker deploying mysql8
- Operational amplifier application summary 1
- Confirm the future development route! Digital economy, digital transformation, data This meeting is very important
- 史上最全学习率调整策略lr_scheduler
- QT 使用QToolTip 鼠标放上去显示文字时会把按钮的图片也显示了、修改提示文字样式
- 使用切面实现记录操作日志
- 概率论公式
猜你喜欢
力扣------路径总和 III
10 ways of interface data security assurance
Hisilicon 3559 universal platform construction: RTSP real-time playback support
【编码字体系列】OpenDyslexic字体
Construction of Hisilicon universal platform: color space conversion YUV2RGB
Operational amplifier application summary 1
[dpdk] dpdk sample source code analysis III: dpdk-l3fwd_ 001
Arduino droplet detection
维护万星开源向量数据库是什么体验
Probability formula
随机推荐
2022电工杯A题高比例风电电力系统储能运行及配置分析思路
QT 项目 表格新建列名称设置 需求练习(找数组消失的数字、最大值)
Implementation of map and set
What is the experience of maintaining Wanxing open source vector database
OSCP工具之一: dirsearch用法大全
Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
ABAP Dynamic Inner table Group cycle
web服务性能监控方案
Collection of idea gradle Lombok errors
Redis源码学习(31),字典学习,dict.c(一)
一些常用软件相关
Web service performance monitoring scheme
使用 BR 备份 TiDB 集群到 GCS
Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND
卡尔曼滤波-1
维护万星开源向量数据库是什么体验
使用切面实现记录操作日志
PHP lightweight Movie Video Search Player source code
ABAP 動態內錶分組循環
HW-小记(二)