HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to delete the remaining binlog files after disabling binlog in MySQL?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
afterremainingthedeletemysqlfileshowdisablingbinlog

Problem

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)

Solution

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.

Code Snippets

FLUSH BINARY LOGS;
PURGE BINARY LOGS BEFORE NOW();
mysql> show binary logs;
ERROR 1381 (HY000): You are not using binary logging
mysql>

Context

StackExchange Database Administrators Q#320507, answer score: 5

Revisions (0)

No revisions yet.