I am having the problem starting up Mysql Container in Docker.
Mysql goes up and than it is constantly in restart
mode.
The Error message what I got is:
[ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of the following:
- MYSQL_ROOT_PASSWORD
- MYSQL_ALLOW_EMPTY_PASSWORD
- MYSQL_RANDOM_ROOT_PASSWORD
[Note] [Entrypoint]: Switching to dedicated user 'mysql'
[Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.28-1debian10 started.
However, 2 of 3 vars are initialized
My docker-compose.yaml
configration for Mysql
is:
mysql:
build: ./.docker/mysql
restart: unless-stopped
environment:
- MYSQL_USER=app
- MYSQL_PASSWORD=123456
- MYSQL_DATABASE=app
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_ALLOW_EMPTY_PASSWORD=true
volumes:
- ./.docker/mysql/data:/var/lib/mysql
networks:
- app
ports:
- "3306:3306"
For those who think that this Post is duplicate.
I have before this post research other posts (stackoverflow), but it doesnt help me (maybe cos I am using the newest Docker version Docker Engine => v20.10.8
and those Posts are from 2016)
What did I do until now
- read
MySql Documentation
about Env vars - try solutions from Docker-compose: Database is uninitialized and docker, MYSQL_ROOT_PASSWORD do not work
- try to remove my existing mysql container and create new one with
docker-compose up -d