Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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
SET GLOBAL expire_logs_days=2 – waza123 Jul 7 '12 at 21:08
up vote 5 down vote accepted

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

share|improve this answer
minor correction - it's expire_logs_days (notice 'logs' instead of 'log') - see… for more detail – Richlv Jun 5 '13 at 9:51

Your Answer


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.