Summary of methods for cleaning up Mysql general_log
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.