Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question
1  
SET GLOBAL expire_logs_days=2 –  waza123 Jul 7 '12 at 21:08

1 Answer 1

up vote 3 down vote accepted

In addition to setting expire_log_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 Binary logs

share|improve this answer
    
minor correction - it's expire_logs_days (notice 'logs' instead of 'log') - see dev.mysql.com/doc/refman/5.5/en/… for more detail –  Richlv Jun 5 '13 at 9:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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