当前位置:网站首页>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
边栏推荐
猜你喜欢

Web service performance monitoring scheme

QT opens a file and uses QFileDialog to obtain the file name, content, etc

运算放大器应用汇总1

机械臂速成小指南(十):可达工作空间
![[leetcode] 450 and 98 (deletion and verification of binary search tree)](/img/89/dd7ac0d886e6bbca5a439386c576bb.jpg)
[leetcode] 450 and 98 (deletion and verification of binary search tree)

VHDL implementation of arbitrary size matrix addition operation

Class常量池与运行时常量池

Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)

PHP lightweight Movie Video Search Player source code

Ggplot facet detail adjustment summary
随机推荐
Implementation steps of docker deploying mysql8
HW notes (II)
Some thoughts on cross end development of kbone and applet
MySQL的存储引擎
太方便了,钉钉上就可完成代码发布审批啦!
Vernacular high concurrency (2)
Redis源码学习(30),字典学习,dict.h
QT item table new column name setting requirement exercise (find the number and maximum value of the array disappear)
Codeworks 5 questions per day (1700 average) - day 7
Redis configuration and optimization of NoSQL
如何检测mysql代码运行是否出现死锁+binlog查看
Docker部署Mysql8的实现步骤
GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议
接口数据安全保证的10种方式
运算放大器应用汇总1
Operational amplifier application summary 1
卡尔曼滤波-1
The most complete learning rate adjustment strategy in history LR_ scheduler
23. (ArcGIS API for JS) ArcGIS API for JS ellipse collection (sketchviewmodel)
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly