In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Because sometimes it will appear, suddenly which field or table will be deleted, and we need to know what content, when and who deleted it, then we can find out what you need from the binlog log. 1.binlogbinlog is the binary log, which records all the changes on the database and saves it on disk in binary form. It can be used to view database change history, database incremental backup and recovery, MySQL replication (master-slave database replication). Because each sql of the modified data is recorded in the binlog. two。 View and configure binlog format (1) View binlog_formatmysql > show variables like 'binlog_format' +-+-+ | Variable_name | Value | +-+-+ | binlog_format | ROW | +-+-+ 1 row in set (0.01sec) binlog format binlog has three formats: Statement, Row and Mixed. -SQL statement based replication (statement-based replication,SBR),-row based replication (row-based replication,RBR),-mixed mode replication (mixed-based replication,MBR). Therefore, the log format can be modified, such as: mysql > set globle binlog_format='MIXED';3.binlog enable and view, delete to see if binlog has enabled mysql > show variables like 'log_bin'. +-+-+ | Variable_name | Value | +-+-+ | log_bin | ON | +-+-+ 1 row in set (0.01 sec) 4. View the list of binlog files mysql > show binary logs +-- +-+ | Log_name | File_size | +-- +-+ | mysql-bin-db02.000001 | 98131952 | mysql-bin-db02.000002 | 4954 | | mysql-bin-db02.000003 | | 248051834 | | mysql-bin-db02.000004 | 22305210 | mysql-bin-db02.000005 | 22305210 | mysql-bin-db02.000006 | 913 | mysql-bin-db02.000007 | 1075503915 | | mysql-bin-db02.000008 | 101154053 | +-+-+ 8 rows in set (0.00 sec) 5. View the binlog file mysql > show master logs that is currently being written +-- +-+ | Log_name | File_size | +-- +-+ | mysql-bin-db02.000001 | 98131952 | mysql-bin-db02.000002 | 4954 | | mysql-bin-db02.000003 | | 248051834 | | mysql-bin-db02.000004 | 22305210 | mysql-bin-db02.000005 | 22305210 | mysql-bin-db02.000006 | 913 | mysql-bin-db02.000007 | 1075503915 | | mysql-bin-db02.000008 | 101481837 | +-+-+ 8 rows in set (0.00 sec) 6. Only view the contents of the first binlog file mysql > show binlog events7. View the contents of the specified binlog file mysql > show binlog events in 'mysql-bin.000002';8. View the binlog file mysql > show master status\ G9 that is currently being written. Get the list of binlog files mysql > show binary logs;10. Check with the mysqlbinlog tool Note: do not view the binlog file currently being written do not add-- force parameter force access if the binlog format is in line mode, please add-vv parameter in order not to affect the database being used I will look at the binary file based on the start / end time mysqlbinlog-- start-datetime='2017-05-10000 stop-datetime='2017-09-1001-01purl 01pur01'-d library name binary file # Note: because my mysqlbinlog is in ROW format. So you need to add-vv parameter mysqlbinlog-- start-datetime='2016-12-20 09-20 09 start-datetime='2016-12-20 09-20 09-30 stop-datetime='2016 40'- vv MySQL-binlog.000001 > / root/1.log-- set the library name,-d db1 based on the posvalue mysqlbinlog-- start-postion=107-- stop-position=1000-d library name binary file 12. Remotely view the specified start / end time, and redirect the result to the local t.binlog file mysqlbinlog-u username-p password-h 172.16.22.7-P3306\-- read-from-remote-server-- start-datetime='2017-05-10 23lv 00lv 00'-- stop-datetime='2017-09-10 23lRV 3000' mysql-bin.000001 > t.binlog you can see what statements are manipulated according to the contents of the t.binlog. Who operated it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.