Clean up MySQL general_ Summary of log method


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_ When log2 executes the deletion of table data, it is found that the data file of the operating system still exists. You need to manually delete the data file, and then continue 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 general_ Log file execution

cat /dev/null > general_log.csv

The discovery also released the size, much faster than the previous one

Method 3

Can be found in the configuration file my.conf Add:


Put the file on a larger disk

The above is the introduction of all knowledge points, thank you for your learning and support for developeppaer.