How I can disable the mysql binlog?

Info about version: mysql Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))

Info about config:

/etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
user            = mysql
bind-address            = 127.0.0.1
key_buffer_size         = 16M
myisam-recover-options  = BACKUP
log_error = /var/log/mysql/error.log
disable-log-bin

But, despite the presence of the string "disable-log-bin" in config, the result is:

mysql> SHOW VARIABLES LIKE 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.02 sec)

log_bin is "ON"

How can I disable it?


Make sure that the correct set of config files is actually used by MySQL. Debian (and in turn Ubuntu) ships the MariaDB config files in the same directory /etc/mysql. Those get used by default, even if MariaDB is not installed.

You can check (and set) the relevant symlink /etc/mysql/my.cnf using the update-alternatives utility:

update-alternatives --config my.cnf