Answer the question
In order to leave comments, you need to log in
How to write slow queries in the project folder in mysql docker container?
Hey! there is a docker with a lamp container. The database config is like this:
db:
image: library/mysql:8.0.20
ports:
- "3307:3306"
environment:
- MYSQL_DATABASE=
- MYSQL_ROOT_PASSWORD=
volumes:
- "./resources/docker/config/my.cfg:/etc/mysql/conf.d/config-file.cnf"
- "./resources/docker/logs/slow.cfg:/var/log/mysql/mysql-slow.log"
- "./resources/schema/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql"
[mysqld]
bind-address = 0.0.0.0
innodb_buffer_pool_size = 1024M
default_authentication_plugin=mysql_native_password
# Slow Queries
slow_query_log = 1
long_query_time = 5
slow_query_log_file = /var/log/mysql/mysql-slow.log
log-queries-not-using-indexes = 1
# Unicode
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/var/log/mysql/mysql-slow.log": permission denied: unknown
Answer the question
In order to leave comments, you need to log in
Before starting docker, create an empty file and give full permissions (of course slow.log and not slow.cfg)
touch ./resources/docker/logs/slow.log
chown 777 ./resources/docker/logs/slow.log
- "./resources/docker/logs/slow.log:/var/log/mysql/mysql-slow.log"
volumes:
- "./resources/docker/config/my.cfg:/etc/mysql/conf.d/config-file.cnf"
- "./resources/docker/logs/mysql/:/var/log/mysql/"
- "./resources/schema/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question