Phenomenon: Web site access more and more slow, and finally inaccessible, after the check found that the disk is full. Careful inquiry down to confirm is because the binlog of MySQL too much occupied space.
Analysis process and solution: Usually this problem should be logged in to the server to check the disk, memory and process use, through the top, df–h and free–m to check, found that disk space is full. Further through the du–sh to the directory can be checked, found that the MySQL binlog occupy too much space. The way to clean the Binlog is as follows:
1 set log retention time long expire_logs_days automatic deletion
To view the current log save days:
Show variables like '%expire_logs_days% ';
This default is 0, that is, logs, you can set the global parameters to enable him to take effect temporarily:
Set global expire_logs_days=7;
Set to keep only 7 days binlog, next restart mysql This parameter defaults will fail, so you need to set up in MY.CNF
Expire_logs_days = 7
2) manually delete binlog (purge binary logs)
Used to delete all binary logs that are listed in the log index before the specified log or date. These logs will also be recorded from the log index file
PURGE {MASTER | BINARY} LOGS to ' Log_name '
PURGE {MASTER | BINARY} LOGS before ' date '
For example:
PURGE MASTER LOGS to ' mysql-bin.010 ';
PURGE MASTER LOGS before ' 2008-06-22 13:00:00 ';
PURGE MASTER LOGS before Date_sub (now (), INTERVAL 3 day);