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 delete mysql binary logs

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Today, I would like to share with you how to delete mysql binary log related knowledge points, the content is detailed, the logic is clear, I believe most people still know too much about this knowledge, so share this article for your reference, I hope you can learn something after reading this article, let's take a look at it.

Methods: 1, use "RESET MASTER" and "RESET SLAVE" command to delete binary log; 2, use "PURGE BINARY LOGS" statement to delete binary log; 3, use "mysqladmin flush-logs" command to delete binary log for more than three days.

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to delete mysql binary log

1. Delete the MySQL binary log using the RESET MASTER statement

The Reset Master statement is used to start a new database during replication of Master and Slave servers. This statement can be used to delete all binary logs.

Clean up the binary logs on the Master server:

Shell > mysql-u username-pmysql > RESET MASTER

Clean up the binary logs on the Slave server:

Mysql-u username-pmysql > RESET SLAVE

2. Delete the MySQL binary log using the PURGE BINARY LOGS statement

The PURGE BINARY LOGS statement removes date-based Binary Log or maximum Binary Log serial numbers.

Based on the binary log example shown above, I want to delete the binaries until mysql-bin.000015 (reserved):

Shell > mysql- u username-pmysql > PURGE BINARY LOGS TO 'mysql-bin.000015'

Alternatively, you can delete binaries earlier than a specific date:

Shell > mysql-u username-pmysql > PURGE BINARY LOGS BEFORE '2009-05-01 00Frl 0000'

3. Use the mysqladmin flush-logs command to delete MySQL Binary Log

Another way is to run the mysqladmin flush-logs command, which deletes binary logs longer than 3 days.

Shell > mysqladmin-u username-p flush-logs above is all the content of the article "how to delete the mysql binary log". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.

Share To

Database

Wechat

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

12
Report