In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is the purpose of understanding mysql log files? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
MySQL log files can be divided into: redo log (redo log), rollback log (undo log), binary log (binlog), error log (errorlog), slow query log (slow query log), general query log (general log), relay log (relay log).
1. Redo log (redo log)
The redo log is a physical format log that records the modification of the physical data page, and its redo log is sequentially written into the physical file of redo log file.
Redoing logs ensures the persistence of transactions. Prevent dirty pages from being written to disk at the point of failure, and redo them according to redo log when the mysql service is restarted, so as to achieve transaction persistence.
2. Roll back the log (undo log)
A rollback log is a log in a logical format that, when performing undo, only logically restores the data to the state it was before the transaction, rather than manipulating it from the physical page, which is different from redo log.
The rollback log saves a version of the data before the transaction and can be used for rollback, while providing MVCC under multi-version concurrency control, that is, unlocked read
3. Binary log (binlog)
A binary log is a log in a logical format that records operations in the database in the form of binaries, but does not record query statements. You can simply think that it is the sql statement in the executed transaction; but it is not as simple as the sql statement, but includes the reverse information of the executed sql statement (addition, deletion and modification), which means that delete corresponds to delete itself and its reverse insert;update corresponds to the information of the version before and after the execution of update; insert corresponds to the information of delete and insert itself.
The binary log can be used for replication. In the master-slave replication, the slave library replays the binlog on the master database to achieve master-slave synchronization; it is used for time-based restore of the database.
4. Error log (errorlog)
The error log records information about mysqld starts and stops, as well as errors that occur while the server is running. By default, the system's ability to log errors is turned off and error messages are output to standard error output.
5. Slow query log (slow query log)
Slow log records query statements that take too long to execute and do not use indexes, and report errors in select, update, delete, and insert statements. Slow logs only record successful statements.
6. General query log (general log)
General log records every query or command received by the server, regardless of whether the query or command is correct or even contains syntax errors. The format of the record is {Time, Id, Command,Argument}. Also because the mysql server needs to keep logging, turning on General log will incur a lot of system overhead. Therefore, Mysql turns General log off by default.
7. Relay log (relay log)
The relay log is similar to binary; it can be used to replicate events used by the slave server to fetch binaries from the master server.
Description:
Among them, redo log and rollback log are closely related to transaction operations, and binary logs are also related to transaction operations. These three kinds of logs are of great significance for understanding transaction operations in MySQL.
Thank you for reading! After reading the above, do you have a general understanding of the functions of mysql log files? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.
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.