My docker compose:
version: '3.9'
services:
mysql_db:
container_name: mysql_db
image: mysql
volumes:
- mysql_data:/var/lib/mysql
- ./my.cnf:/etc/my.cnf
environment:
- MYSQL_ROOT_PASSWORD=pass
volumes:
mysql_data:
name: mysql_data
The named volume mysql_data doesn't exist.
I start the container as root user with docker compose up -d.
Upon log inspection I get:
root@grafana:~/mysql# docker compose up -d
[+] Running 3/3
⠿ Network mysql_default Created 0.1s
⠿ Volume "mysql_data" Created 0.0s
⠿ Container mysql_db Started 0.7s
root@grafana:~/mysql# docker logs mysql_db
2022-09-16 09:47:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-09-16 09:47:19+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-09-16 09:47:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-09-16 09:47:20+00:00 [Note] [Entrypoint]: Initializing database files
2022-09-16T09:47:20.072562Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-09-16T09:47:20.072669Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.30) initializing of server in progress as process 80
2022-09-16T09:47:20.081991Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-09-16T09:47:20.675144Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-09-16T09:47:22.257058Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
Why empty password ????