Get the App
SLTechnology News&Howtos  ›  Database  › 

Summary of methods for cleaning up Mysql general_log

Shulou Source: shulou.com Published: 2022-06-01 03:17:06 10月04日 Update

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.

Tags: File method data operating system content size that is manual time step knowledge knowledge point disk system or learning support configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft MariaDB Shulou Tech Info Docker