Server version: 5.1.50-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show binary logs ;


  • Data directory is full
  • I want to remove space
  • Purge is not making more space.

Any idea what to do to clear relay logs and Bin file .

  • you need the SUPER privilege for this operation. Jun 24, 2015 at 6:22
  • Are binary logs and mysql data in the same folder ??? Jun 24, 2015 at 14:19

1 Answer 1


When the folder with binary logs is full, mysqld will freeze everything that does a write to a MyISAM table (even temporary MyISAM tables). See my post "Site Offline" MySQL server failing to start and stop as to why. Anyway, mysqld will wait for free diskspace before continuing whatever operation it was doing. In this particular instance, you must go to the OS and delete the binary logs, but not all of them.

For example, if you defined


go to the OS and run this

cd /var/lib/mysql
ls -l mysql-bin.*

You will see all the binary logs. Delete just the first 2 or 3 binary logs.

Log back into mysql and run SHOW BINARY LOGS;

It will eventually kick in when the free space is acknowledged by mysqld.

Then, you can run PURGE BINARY TO 'mysql-bin.xxxxxx';

You may also have to look into the error log or slow log. If they are big, truncate them like this:

cd /var/lib/mysql
echo -n > error-log.log


  • And set expire_logs_days so you won't have to do this again.
    – Rick James
    Jun 28, 2015 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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