version: "3.9"

services:
  mysql:
    image: mysql:8.0
    container_name: mining_mysql
    restart: unless-stopped
    ports:
      - "3306:3306"              # host:container
    environment:
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_DATABASE: mining_app
      MYSQL_USER: mining_user
      MYSQL_PASSWORD: StrongPassword123!
    command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    volumes:
      - mysql_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-prootpass"]
      interval: 10s
      timeout: 5s
      retries: 10

volumes:
  mysql_data:
