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)

Niyaz
  • 218
  • 1
  • 10

2 Answers2

5

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.

RolandoMySQLDBA
  • 182,700
  • 33
  • 317
  • 520
  • 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 Dec 03 '22 at 08:00
  • 1
    Now that binary logging is disabled, you can go and delete them manually – RolandoMySQLDBA Dec 03 '22 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

Sarva
  • 1