Unable to enable binlog on a Dockerized MySQL service through mounting my.cnf file

Viewed 16

I am trying to enable bin logging on my MySQL to deploy Debezium MySQL connector. I have the following docker-compose.yml file.

version: '3'
services:
  ...
  mysqldb:
    image: mysql:5.7
    container_name: db_mysql
    ports:
      - '3306:3306'
    environment:
      - MYSQL_ROOT_HOST=${DB_HOST}
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}  
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_NAME}
    volumes:
      - database_mysql:/var/lib/mysql
      - my.cnf:/etc/mysql/my.cnf
    networks:
      - user

I also use the following my.cnf file.

[mysqld]
performance_schema  = ON
server-id           = 223344
log_bin             = mysql-bin
binlog_format       = ROW
binlog_row_image    = FULL
expire_logs_days    = 10

Running the CLI on the docker container, I can see that the my.cnf file is mounted well, but bin logging is still enabled. When I try to run the following commands after logging into mysql in the shell, it spits out the following results.

mysql> SELECT variable_value as "BINARY LOGGING STATUS (log-bin) ::"
    -> FROM information_schema.global_variables WHERE variable_name='log_bin';
ERROR 3167 (HY000): The 'INFORMATION_SCHEMA.GLOBAL_VARIABLES' feature is disabled; see the documentation for 'show_compatibility_56'

mysql> SELECT variable_value as "BINARY LOGGING STATUS (log-bin) ::"
    -> FROM performance_schema.global_variables WHERE variable_name='log_bin';
+------------------------------------+
| BINARY LOGGING STATUS (log-bin) :: |
+------------------------------------+
| OFF                                |
+------------------------------------+
1 row in set (0.02 sec)

Could anyone please let me know how I can enable bin logging on my MySQL service so that I can deploy Debezium MySQL connector?

0 Answers
Related