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

Disable MySQL binary logging with log_bin variable

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

Problem

Default MySQL config file /etc/mysql/my.cnf installed by some debian package using APT often set log_bin variable, so binlog are enabled:

log_bin = /var/log/mysql/mysql-bin.log


When I want to disable binary logging on such installation, comment out the line in my.cnf works of course, but I wonder if there is a way to disable binary logging by setting explicitely log_bin to OFF, in a debian style, I mean in an included file like /etc/mysql/conf.d/myCustomFile.cnf, so default my.cnf is not changed and can be easily updated by apt, if necessary.

I tried "log_bin = 0", "log_bin = OFF" or "log_bin =" but none works...

Solution

This is an old question, but it came up in a search while I was trying to jog my memory about the correct option name and so now that I've figured it out I'm adding the details here.

The key part of the question is:

I mean in an included file like /etc/mysql/conf.d/myCustomFile.cnf

You can do this from an included option file using the option skip-log-bin. E.g. you might create /etc/mysql/conf.d/disable_binary_log.cnf with the following contents:

[mysqld]
skip-log-bin


You can add skip- as a prefix to other options to disable them in this way too.

Related Q & A: To clear currently accumulated logs, see this answer.

Code Snippets

[mysqld]
skip-log-bin

Context

StackExchange Database Administrators Q#72770, answer score: 98

Revisions (0)

No revisions yet.