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

Summary of methods for cleaning up Mysql general_log

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Method 1:

SET GLOBAL general_log = 'OFF';RENAME TABLE mysql.general_log TO mysql.general_log2;DELETE FROM mysql.general_log2

Note: when DELETE FROM mysql.general_log2 deletes table data, it is found that the operating system data file still exists. You need to delete the data file manually before continuing with the following data operation steps.

OPTIMIZE TABLE general_log2;RENAME TABLE mysql.general_log2 TO mysql.general_log;SET GLOBAL general_log = 'ON'

This method takes a long time.

Method 2:

SET GLOBAL general_log = 'OFF'

Find the file execution of general_log

Cat / dev/null > general_log.csv

It was found that the size was also released, much faster than the previous one.

Method 3:

You can add to the configuration file my.conf:

General_log=1general_log_file='/data/mysql/general_log.CSV'

Put files on a larger disk

These are all the knowledge points of this introduction. Thank you for your study and 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