3

I use this solution to delete my binlog before I disable the log. After I disabled it, I tested the below commands to remove the remaining files, but without success.(The purpose of deleting is to save space.)

PURGE BINARY LOGS TO 'binlogname';
PURGE BINARY LOGS BEFORE 'datetimestamp';

My question is: Is it safe to remove them manually? (I found those questions question1 and question2 which are similar to mine but the answer is uncertain to me)

2 Answers 2

5
+50

As I said in my post from Apr 26, 2013 21:57

Please do not just delete them in the OS.

First you run the purge like this

FLUSH BINARY LOGS;
PURGE BINARY LOGS BEFORE NOW();

Then, go disable it.

Once you disable binary logging, the PURGE BINARY LOGS will say nothing.

If you run SHOW BINARY LOGS, you should see

mysql> show binary logs;
ERROR 1381 (HY000): You are not using binary logging
mysql>

I stated the reasons for not doing it while mysqld is running in my old post.

2
  • thanks, It works 100%. All the heavy log has gone, only binlog.index and binlog.last remains with size less than 1KB; Which I think they should remain, and there are no ways to eliminate them.
    – Niyaz
    Commented Dec 3, 2022 at 8:00
  • 1
    Now that binary logging is disabled, you can go and delete them manually Commented Dec 3, 2022 at 13:42
-1

Just remove binlog.**** files from /var/lib/mysql, with binlog.index files and restart mysql. So it will create binlog.index again and fix

1
  • 1
    The OP is saying that they cant delete the files!!! Commented Jan 5 at 12:24

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.