I am trying to get my mysql image running with utf-8 encoding. My docker-compose file looks like:
version: '2'
services:
db:
container_name: zoho-grabber-db-development
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=topsecret
- MYSQL_DATABASE=development
- MYSQL_USER=devuser
- MYSQL_PASSWORD=secure
ports:
- "3306:3306"
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
When i run it, it says
$ docker-compose -f docker-compose.development.yml up
Removing zoho-grabber-db-development
Recreating 1b341fd7916e_1b341fd7916e_zoho-grabber-db-development
ERROR: for db Cannot start service db: oci runtime error: container_linux.go:247: starting container process caused "exec: \"mysqld\": executable file not found in $PATH"
ERROR: Encountered errors while bringing up the project.
Why is mysqld not found? And how to achieve my goal?
When using command
in docker-compose.yml
it overrides the default command
and entrypoint
as described in the docker-compose documentation. In order for you to achieve your goal, I suggest that you mount a my.cnf
as a volume as described in the docker image's readme under section "Using a custom MySQL configuration file".
So remove command
from your docker-compose and add volumes
eg.
...
volumes:
- mycustom.cnf:/etc/mysql/conf.d/custom.cnf
...
and the container will include your custom configuration as the server's configuration
Edit-1
Below is the custom config the you need
mycustom.cnf
[mysqld]
character-set-server = utf8
collation-server = utf8_unicode_ci
skip-character-set-client-handshake
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