# Disable binary logs while purging the records

**URL:** <https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083>\
**Category:** Percona Toolkit\
**Created:** [February 27, 2015, 3:48pm UTC](https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083 "2015-02-27T15:48:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishna](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@krishna](https://forums.percona.com/u/krishna)\
**Post date:** [February 27, 2015, 3:48pm UTC](https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083/1 "2015-02-27T15:48:37Z")

</div>

Hi Team,

We have a parameter “–binlog-ignore-db” to disable logging for a particular database. Here, if the parameter is not existing in my.cnf file we have to add in the configuration file and restart mysql to have the changes affective. Below are the variables that are currently enabled as per the DB:

±----------------------------------------±------+  
| Variable\_name | Value |  
±----------------------------------------±------+  
| binlog\_cache\_size | 32768 |  
| binlog\_direct\_non\_transactional\_updates | OFF |  
| binlog\_format | ROW |  
| binlog\_stmt\_cache\_size | 32768 |  
±----------------------------------------±------+

Is there a way where I can add the parameter dynamically as we will not be able to restart the mysql instance as there are other DB’s running which cannot be down for a second. Please suggest…!

Best Regards,  
Krishna

---

<div class="post-metadata">

**Author:** ![mmike](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mmike](https://forums.percona.com/u/mmike)\
**Post date:** [February 27, 2015, 5:33pm UTC](https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083/2 "2015-02-27T17:33:56Z")

</div>

Hi, Krishna.

Unfortinately, there is no way to do so as binlog-ignore-db is a command-line/config-file option. You can see if those are set while mysql is running with ‘show master status’.

[url][MySQL :: MySQL 5.6 Reference Manual :: 17.1.4.4 Binary Log Options and Variables](http://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html#option_mysqld_binlog-ignore-db%5B/url%5D)

---

<div class="post-metadata">

**Author:** ![krishna](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@krishna](https://forums.percona.com/u/krishna)\
**Post date:** [March 3, 2015, 10:27am UTC](https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083/3 "2015-03-03T10:27:24Z")

</div>

Hi Mike,

Thanks for your reply.

Could you please have this incorporated in the next release of MySQL as it can be a good option to ignore binary logging when we are performing huge operations on particular Database.

Thanks,  
Krishna

---

<div class="post-metadata">

**Author:** ![unixronin](https://avatars.discourse-cdn.com/v4/letter/u/8491ac/32.png) [@unixronin](https://forums.percona.com/u/unixronin)\
**Post date:** [March 26, 2015, 2:16pm UTC](https://forums.percona.com/t/disable-binary-logs-while-purging-the-records/4083/4 "2015-03-26T14:16:43Z")

</div>

Krishna, Allow me to introduce you to an already-existing MySQL feature: SET SESSION SQL\_LOG\_BIN = 0; This will allow you to selectively have all commands _in that session_ omitted from the binlog. The setting remains in effect for the duration of the setting. However, keep in mind that if you do this, then your master and your slave will be massively out of sync after your “huge operation” is done, unless you manually apply the same set changes on each of your slave(s) as well.
