Disable MySQL binary logging with log_bin variable

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.


In MySQL 8 it is the option disable_log_bin which has to be provided without any parameter in the my.cnf file in the [mysqld] section.

[mysqld]
disable_log_bin
some-other-option = any-value

If you are not replicating, you can disable binlogging by changing your my.ini or my.cnf file. Open your my.ini or /etc/my.cnf (/etc/mysql/my.cnf), enter:

# vi /etc/my.cnf

Find a line that reads "log_bin" and remove or comment it as follows:

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

You also need to remove or comment following lines:

#expire_logs_days = 10

#max_binlog_size = 100M

Close and save the file. Finally, restart mysql server:

# service mysql restart