Skip to content

Cannot access to mysql from client after initialization #1070

@laurafbec

Description

@laurafbec

Hi everyone,
I'm trying to develop a docker compsoe file to initialize a mmysql database. The problem is that access is not allow from outside the container unless it would be restarted.
First time it is launched, socket is listening at port 0, even though I indicate a different port in the my.cnf file.

2024-06-21T07:36:42.991794Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.37'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.

This is the compose file:

services:
  database:
    image: mysql:8.0
    container_name: mysql
    restart: always
    environment:
      MYSQL_DATABASE: 'flughafendb'
      MYSQL_ROOT_PASSWORD: 'root'
      MYSQL_USER: 'flughafen-user'
      MYSQL_PASSWORD: 'secret'      
      MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
    ports:
      - '3306:3306'
    healthcheck:
      test: ["CMD-SHELL", "cat /tmp/mysql-general-log.log | grep \"(1176552,330064,'11A',31286,350.95)\""]
      interval: 10s
      retries: 120
    volumes:
      - ${PWD}/docker/db/sql/flughafendb_large.sql.gz:/docker-entrypoint-initdb.d/0.sql.gz
      #- ${PWD}/docker/db/sql/flughafendb_large.sql:/tmp/flughafendb_large.sql
      - ${PWD}/docker/db/data:/var/lib/mysql
      - ${PWD}/docker/db/my.cnf:/etc/my.cnf

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions