Can I remove binary log files not listed in mysql-bin.index? We've had some problems with one of our more elderly MySQL servers (version 5.045).  The database is back up and running OK but there were over twenty thousand binary log files in the mysql folder.

I logged into MySQL and issued the following command after checking that data replication was all working OK...

purge binary logs to 'mysql-bin.024717';


The command completed without error and the resulting mysql-bin.index looks like this...

./mysql-bin.024717
./mysql-bin.024718
./mysql-bin.024719
./mysql-bin.024720
./mysql-bin.024721
./mysql-bin.024722
./mysql-bin.024723
./mysql-bin.024724


When I left mysql a lot of files had gone, but now there are still over a thousand binary log files left, all from before mysql-bin.024717 and most of them only containing 117 bytes.

Given that they are no longer referenced in the mysql-bin.index file is it OK for me to just go ahead and remove them with rm at the OS level or do I need to do something else to clean them up?

Thanks in Advance
You can also try purge binary logs before '2016-04-29 08:00:00'. I sometimes find one works when the other doesn't for some reason.

Failing that just delete them with rm like you said. It's not technically correct, but it shouldn't be a problem (I did this frequently in the past before I learned about the PURGE commands, and never had any problems).

Of course you also want to make sure you have expire_logs_days set as well to keep them down in future.

I also just saw this note:


  Prior to MySQL 5.1.24, PURGE BINARY LOGS TO and PURGE BINARY LOGS
  BEFORE did not behave in the same way (and neither one behaved
  correctly) when binary log files listed in the .index file had been
  removed


for some reason I don't have access to the 5.0 page to check what that says.