Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use commands to clean up binlog logs in a Mysql database

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How do I use the command to clean up the binlog log in the Mysql database? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

1. View the binlog log

Mysql > show binary logs

2. Delete all log files before a log file is deleted

Purge binary logs to 'mysql-bin.000035'

3. Clean up the binlog log before 13:00:00 in 2019-09-09.

PURGE MASTER LOGS BEFORE '2019-09-09 13 purl 0000'

4. Clean up the binlog log 3 days ago

PURGE MASTER LOGS BEFORE DATE_SUB (NOW (), INTERVAL 3 DAY);-- BEFORE, the date argument of a variable can be in 'YYYY-MM-DD hh:mm:ss' format. The cleanup here refers to the file from now on-3243600s ago, which is the last time this file was updated. -- the time and the file name must not be misspelled, especially the year in the time and the sequence number in the file name, in case you accidentally delete the binlog you are using! Do not delete binlogboxes that are in use!

5. Reset all logs

Reset master

6. Manually switch binlog logs

Flush logs-- or flush binary logs

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report