SQLSTATE [HY000] [2006] MySQL сервер пропал в docker - PullRequest
0 голосов
/ 26 мая 2020

Не работает при подключении к базе данных docker, docker находится на хосте, возможно, проблема в localhost, я не могу понять, в чем именно проблема, поэтому прикрепляю статус контейнер mysql ниже, я повторяю, возможно, причина именно в том, что я развертываю docker на сервере, а не на локальном хосте, но я не уверен, должна ли быть проблема с этим

staging-mariadb

staging-mariadb        | 2020-05-26 08:17:50+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.13+maria~bionic started.
staging-mariadb        | 2020-05-26 08:17:50+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
staging-mariadb        | 2020-05-26 08:17:50+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.13+maria~bionic started.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] mysqld (mysqld 10.4.13-MariaDB-1:10.4.13+maria~bionic) starting as process 1 ...
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Using Linux native AIO
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Uses event mutexes
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Number of pools: 1
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Using SSE2 crc32 instructions
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Completed initialization of buffer pool
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Waiting for purge to start
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: 10.4.13 started; log sequence number 60990; transaction id 21
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] Plugin 'FEEDBACK' is disabled.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] Server socket created on IP: '::'.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] InnoDB: Buffer pool(s) load completed at 200526  8:17:51
staging-mariadb        | 2020-05-26  8:17:51 0 [Warning] 'user' entry 'root@3995f63929b6' ignored in --skip-name-resolve mode.
staging-mariadb        | 2020-05-26  8:17:51 0 [Warning] 'user' entry '@3995f63929b6' ignored in --skip-name-resolve mode.
staging-mariadb        | 2020-05-26  8:17:51 0 [Warning] 'proxies_priv' entry '@% root@3995f63929b6' ignored in --skip-name-resolve mode.
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] Reading of all Master_info entries succeeded
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] Added new Master_info '' to hash table
staging-mariadb        | 2020-05-26  8:17:51 0 [Note] mysqld: ready for connections.
staging-mariadb        | Version: '10.4.13-MariaDB-1:10.4.13+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
staging-mariadb        | 2020-05-26  8:21:54 8 [Warning] Aborted connection 8 to db: 'unconnected' user: 'unauthenticated' host: '192.168.144.3' (This connection closed normally without authentication)
staging-mariadb        | 2020-05-26  8:21:54 9 [Warning] Aborted connection 9 to db: 'unconnected' user: 'unauthenticated' host: '192.168.144.3' (This connection closed normally without authentication)

docker -compose

version: "3.7"

services:

  staging-nginx:
    container_name: staging-nginx
    build:
      context: project/docker
      dockerfile: staging/nginx/Dockerfile
    ports:
      - ${PROJECT_PORT}:80
    volumes:
      - ./project:/app
    depends_on:
      - staging-php-fpm
      - staging-php-cli

  staging-php-fpm:
    container_name: staging-php-fpm
    build:
      context: project/docker
      dockerfile: staging/php-fpm/Dockerfile
    environment:
      YII_DEBUG: ${YII_DEBUG}
      YII_ENV: ${YII_ENV}
      COOKIE_KEY: ${COOKIE_KEY}
      MYSQL_HOST: ${MYSQL_HOST}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE_TABLE_PREFIX: ${MYSQL_DATABASE_TABLE_PREFIX}
      PROJECT_PORT: ${PROJECT_PORT}
      MYSQL_PORT: ${MYSQL_PORT}
      PHPMYADMIN_PORT: ${PHPMYADMIN_PORT}
      API_URL: ${API_URL}
      API_PATH: ${API_PATH}
      API_NAME: ${API_NAME}
      API_EXACT_VERSION: ${API_EXACT_VERSION}
      APP_ADMIN_NAME: ${APP_ADMIN_NAME}
      APP_ADMIN_EMAIL: ${APP_ADMIN_EMAIL}
      APP_ADMIN_PASSWORD: ${APP_ADMIN_PASSWORD}
    volumes:
      - ./project:/app
    depends_on:
      - staging-mariadb

  staging-php-cli:
    container_name: project-php-cli
    build:
      context: project/docker
      dockerfile: staging/php-cli/Dockerfile
    environment:
      YII_DEBUG: ${YII_DEBUG}
      YII_ENV: ${YII_ENV}
      COOKIE_KEY: ${COOKIE_KEY}
      MYSQL_HOST: ${MYSQL_HOST}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE_TABLE_PREFIX: ${MYSQL_DATABASE_TABLE_PREFIX}
      PROJECT_PORT: ${PROJECT_PORT}
      MYSQL_PORT: ${MYSQL_PORT}
      PHPMYADMIN_PORT: ${PHPMYADMIN_PORT}
      API_URL: ${API_URL}
      API_PATH: ${API_PATH}
      API_NAME: ${API_NAME}
      API_EXACT_VERSION: ${API_EXACT_VERSION}
      APP_ADMIN_NAME: ${APP_ADMIN_NAME}
      APP_ADMIN_EMAIL: ${APP_ADMIN_EMAIL}
      APP_ADMIN_PASSWORD: ${APP_ADMIN_PASSWORD}
    volumes:
      - ./project:/app
      - composer:/root/.composer/cache
    depends_on:
      - staging-mariadb

  staging-mariadb:
    container_name: staging-mariadb
    build:
      context: project/docker
      dockerfile: staging/mariadb/Dockerfile
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 1
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    ports:
      - ${MYSQL_PORT}:3306
    volumes:
      - db:/var/lib/mysql

volumes:
  composer:
  db:
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...