In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to use update log files in MySQL. The quality of the article is high, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.
log-enabled
When started with the--log-update=file_name option, d writes all SQL commands that update data to the log file. Files are written to the data directory and have a name file_name.#, Here #is a number that is incremented by 1 each time mysqladmin refresh or mysqladmin flush-logs, FLUSH LOGS statements, or server restarts are executed.
If you do not specify file_name, the server hostname is used by default.
If you specify an extension in a file hit, then the update log no longer uses sequential files, but uses the specified file. But the log file is cleared every time you execute mysqladmin refresh or mysqladmin flush-logs, FLUSH LOGS statements, or restart the server.
The update record is smart because it only records statements that actually update data. So if a WHERE UPDATE or Delete cannot find a row, it is not written to the record file. It even skips UPDATE statements that set a column to a value it already has.
rewrite log
It is important to note that a new log file will be used in one of the following cases-the order of log files is automatically incremented (file_name is not specified or specified file_name does not include extension) or the file is emptied (specified file_name includes extension):
Command mysqladmin refresh
command mysqladmin flush-logs
SQL statement FLUSH LOGS
server restarts
Recovery log contents
For all update log files, you can specify it as input to the mysql client to execute SQL statements to recover data. For example:
shell>mysql
However, you may have mistakenly deleted it by executing DROP DATABASE and want to restore only the contents of that database. To do this, you can use the--one-database option:
shell>mysql --one-database db_name < hostname.nnn
If you want to restore update log data in bulk, you can do this in Unix:
$ ls -t -r -l hostname. [0-9]* | xargs cat | mysql --one-database db_name
Note that since the files are sorted chronologically, if you modify any of them, you may import the wrong data because of the wrong order.
If you want to restore data in file order, remove the-t and-r options:
$ ls -l hostname. [0-9]* | xargs cat | mysql --one-database db_name
How to use update log files in MySQL is shared here. I hope the above content can be of some help to everyone and learn more. If you think the article is good, you can share it so that more people can see 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.