According to the link: Docker Hub under section Using a custom MySQL Configuration File, I should be able to startup MySQL with some custom configurations. I have added the following configs to my my.cnf
file to enable bin logging.
[mysqld]
performance_schema=ON
server-id=223344
log_bin=mysql-bin
binlog_format=ROW
binlog_row_image=FULL
My folder structure is the following.
user
|- docker-compose.yml
|- mysql-config
|- my.cnf
...
Then, I have the following docker-compose specification for MySQL.
version: '3'
services:
mysqldb:
image: mysql:5.7
container_name: db_mysql
command: ["--server-id=223344", "--log_bin=mysql-bin"]
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
- mysql-config:/etc/mysql/conf.d
networks:
- user
volumes:
...
mysql-config:
When I run the MySQL service, I cannot find the my.cnf
file that should have been mounted on /etc/mysql/conf.d/my.cnf
for some reason. Furthermore, the my.cnf
file is located at /etc/my.cnf
instead of /etc/mysql/my.cnf
as mentioned in the doc.
Could someone please let me know how I can mount the file correctly so my MySQL starts with the configs listed above?