8

I have a problem with full disk

-rw-rw----  1 mysql mysql 1073741982 2012-07-03 18:14 mysql-bin.000034
-rw-rw----  1 mysql mysql 1073741890 2012-07-04 14:39 mysql-bin.000035
-rw-rw----  1 mysql mysql 1073741988 2012-07-05 09:16 mysql-bin.000036
-rw-rw----  1 mysql mysql 1073741964 2012-07-06 00:04 mysql-bin.000037
-rw-rw----  1 mysql mysql 1073741974 2012-07-06 21:45 mysql-bin.000038
-rw-rw----  1 mysql mysql 1073741923 2012-07-07 19:05 mysql-bin.000039
-rw-rw----  1 mysql mysql  356167680 2012-07-07 23:47 mysql-bin.000040

my.cnf:

max_binlog_size = 1073741824
log-bin = mysql-bin
max_relay_log_size = 1G
relay_log_space_limit = 2G

mysql is creating files mysql-bin.xxxxx and my disk is full after several days.

How to make mysql to delete old logs ?

  • 3
    SET GLOBAL expire_logs_days=2 – waza123 Jul 7 '12 at 21:08
8

In addition to setting expire_logs_days you can run a command immediately to purge old logs:

mysql> PURGE BINARY LOGS TO 'mysql-bin.000039';

Make sure no slaves are reading from logs you're trying to purge, or you will break replication.

See the MySQL Reference Manual: Binary logs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.