This is my docker-compose.yml file:
version: "3.9"
services:
db:
image: mariadb:10.5
restart: always
environment:
MARIADB_ROOT_PASSWORD: "mypassword"
MARIADB_DATABASE: "mydb"
MARIADB_USER: "myuser"
MARIADB_PASSWORD: "mypassword"
MYSQL_ROOT_PASSWORD: "mypassword"
MYSQL_DATABASE: "mydb"
MYSQL_USER: "myuser"
MYSQL_PASSWORD: "mypassword"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 10s
retries: 10
This is how I build and start my container
docker-compose -f docker-compose.yml up --build -d
After MariaDB started I try to connect to the database inside the container
docker exec -it CONTAINERID /bin/bash
root@a88f9980d7f6:/# mariadb -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Any idea why this is not working for me?
System informations:
Docker version 20.10.17, build 100c701
Docker Compose version v2.6.1
Linux dev 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
Debian GNU/Linux 10 (buster)