Home  >  Article  >  Database  >  What is mysql binlog

What is mysql binlog

藏色散人
藏色散人Original
2023-04-03 15:31:251755browse

mysql binlog is a "binary log"; binlog is a binary log that records all database table structure changes and table data modifications, but operations such as SELECT and SHOW are not recorded because such operations have no impact on the data itself. Revise.

What is mysql binlog

The operating environment of this tutorial: Windows 10 system, mysql8 version, Dell G3 computer.

What is mysql binlog?

Introduction to binlog:

binlog (binary log)

binlog It is a binary log that records all database table structure changes (such as CREATE, ALTER TABLE...) and table data modifications (INSERT, UPDATE, DELETE...).

Binlog will not record operations such as SELECT and SHOW, because such operations do not modify the data itself, but you can view all statements executed by MySQL by querying the general log.

The binary log includes two types of files: the binary log index file (the file name suffix is ​​.index) is used to record all binary files, and the binary log file (the file name suffix is ​​.00000*) records all DDL of the database and DML (except data query statements) statement events.

Transaction log introduction:

Innodb transaction log includes redo log and undo log.

undo log refers to before the transaction starts, before operating any data, first back up the data to be operated to a place

redo log refers to any data operated in the transaction, back up the latest data Go to a place

Purpose of transaction log: If the instance or media fails, the transaction log file can come in handy.

1. The redo log is not written as the transaction is committed, but begins to be written to the redo during the execution of the transaction. Specific placement strategies can be configured. To prevent dirty pages from being written to the disk at the time of failure, when restarting the mysql service, redo is performed based on the redo log, thereby achieving the feature of persisting the transaction data that has not been written to the disk. RedoLog is a product that appears to achieve transaction durability

2.undo log is used to roll back row records to a certain version. Before the transaction is submitted, Undo saves the version data before it is submitted. The data in Undo can be used as a snapshot of the old version of the data for snapshot reading by other concurrent transactions. It is a product that appears to achieve the atomicity of transactions. It is used to implement multi-version concurrency control in the Mysql innodb storage engine

[Related recommendations: mysql video tutorial]

The above is the detailed content of What is mysql binlog. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is mysql socketNext article:what is mysql socket