I have such a docker-compose.yml
:
database:
container_name: test_db
image: mysql:5.7
volumes:
- ./docker/my.cnf:/etc/my.cnf
environment:
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=test_db"
ports:
- "3306:3306"
volumes:
- test_db_data:/var/lib/mysql
volumes:
test_db_data:
and I want to edit the sql_mode
.
./docker/my.cnf
contains:
[mysqld]
sql_mode=""
But when I connect to db from my local machine and run SELECT @@sql_mode;
I receive:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
What am I doing wrong?
You can add this to your db service:
command: --sql_mode=""
so its:
database:
container_name: test_db
image: mysql:5.7
volumes:
- ./docker/my.cnf:/etc/my.cnf
environment:
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=test_db"
ports:
- "3306:3306"
volumes:
- test_db_data:/var/lib/mysql
command: --sql_mode=""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With