I want to add MariaDB to my docker compose file, like this:
version: '3'
services:
mariadb:
image: 'mariadb:10.3'
ports:
- "3306:3306"
volumes:
- "${PWD}/data/mariadb:/var/lib/mysql:rw"
environment:
MYSQL_ROOT_PASSWORD: 'rootpass'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_USER: 'dev'
Now I can connect using -uroot -p
and entering the rootpass
password, but I can't connect using -udev
and no password. It says:
ERROR 1045 (28000): Access denied for user 'dev'@'172.31.0.1' (using password: NO)
I also tried adding MYSQL_PASSWORD: ~
or MYSQL_PASSWORD: ''
to the environment variables, but that also doesn't work.
It works when I add an actual password MYSQL_PASSWORD: 'dev'
, but I can't get it working without password. Does anyone know the magic combination of env vars?
The reason I want to achieve this, is because my team has this set up currently in a different way and everyone has a .my.cnf
file containing user=dev
and password=
. So it would be nice if everyone could keep this local config unchanged.