当前位置:网站首页>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
-vOutput details ( Speed up parsing ) - If it's on
binlog_rows_query_log_eventsParameters , Need to use-vvParameters can display specific SQL sentence
边栏推荐
- PHP lightweight Movie Video Search Player source code
- Simple implementation of AVL tree insertion and verification operations
- QT thread and other 01 concepts
- Implementation of binary search tree
- opencv第三方库
- Gpt-3 is a peer review online when it has been submitted for its own research
- Hongmi K40S root gameplay notes
- Redis源码学习(30),字典学习,dict.h
- ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
- On file uploading of network security
猜你喜欢

ggplot 分面的细节调整汇总

太方便了,钉钉上就可完成代码发布审批啦!

Kotlin Android environment construction

Antd Comment 递归循环评论

2022夏每日一题(一)

Gpt-3 is a peer review online when it has been submitted for its own research

Storage of data

My brave way to line -- elaborate on what happens when the browser enters the URL

Do you choose pandas or SQL for the top 1 of data analysis in your mind?

Simple implementation of AVL tree insertion and verification operations
随机推荐
使用切面实现记录操作日志
本机mysql
2022夏每日一题(一)
Class constant pool and runtime constant pool
The most complete learning rate adjustment strategy in history LR_ scheduler
Redis configuration and optimization of NoSQL
ABAP 動態內錶分組循環
First understand the principle of network
GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议
Free PHP online decryption tool source code v1.2
One of oscp tools: dirsearch usage Encyclopedia
UltraEdit-32 温馨提示:右协会,取消 bak文件[通俗易懂]
codeforces每日5题(均1700)-第七天
史上最全学习率调整策略lr_scheduler
红米k40s root玩机笔记
10 ways of interface data security assurance
Index of MySQL
Probability formula
Redis源码学习(30),字典学习,dict.h
vim —- 自己主动的按钮indent该命令「建议收藏」