NodeJS MySQL容器保持不连接到我的容器

sdnqo3pr  于 2023-01-12  发布在  Node.js
关注(0)|答案(2)|浏览(288)

我正在使用docker-compose启动mysql服务器,下面是我的docker-compose.yml文件:

version: "3.9"
services:
  mysqldb:
    image: mysql:8.0
    container_name: mysqlcontainer
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
    volumes:
      - ./db/init.sql:/docker-entrypoint-initdb.d/0_init.sql
      - C:/Users/crisp/OneDrive/Desktop/html/database:/var/lib/mysql
    ports:
      - 8080:3306
    expose:
      - 8080
    environment:
      MYSQL_DATABASE: todos
      MYSQL_USER: admin
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password
      SERVICE_TAGS: dev
      SERVICE_NAME: mysqldb
    networks:
      - internalnet
networks:
  internalnet:
    driver: bridge

现在,当我使用ps docker命令时,得到的结果如下:状态始终为Restarting

CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS                        PORTS     NAMES
6f8053143edf   mysql:8.0   "docker-entrypoint.s…"   14 seconds ago   Restarting (1) 1 second ago             mysqlcontainer

如果我尝试在容器上使用logs命令进行调试,下面是我得到的日志

2022-08-03 06:13:31+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:13:31+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:13:31+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:13:32.094297Z 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-08-03T06:13:32.108996Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:13:32.109026Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:13:32.122288Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:13:32.235605Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:13:32.929506Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:13:33.170552Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:13:33.170867Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:13:33.171051Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:13:33.172827Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:13:37+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:13:37+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:13:37+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:13:37.902864Z 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-08-03T06:13:37.916272Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:13:37.916302Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:13:37.929765Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:13:37.974966Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:13:38.676248Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:13:38.959483Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:13:38.959809Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:13:38.959870Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:13:38.961245Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:13:42+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:13:43+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:13:43+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:13:43.811176Z 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-08-03T06:13:43.826556Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:13:43.826611Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:13:43.846354Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:13:43.918855Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:13:44.772517Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:13:45.021113Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:13:45.021339Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:13:45.021415Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:13:45.023388Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:13:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:13:49+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:13:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:13:49.826617Z 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-08-03T06:13:49.839972Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:13:49.840130Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:13:49.854179Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:13:49.907502Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:13:50.701530Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:13:50.932839Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:13:50.933362Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:13:50.933448Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:13:50.934985Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:13:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:13:55+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:13:55+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:13:55.672533Z 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-08-03T06:13:55.686526Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:13:55.686557Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:13:55.700405Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:13:55.796139Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:13:56.593853Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:13:56.867322Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:13:56.867705Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:13:56.867752Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:13:56.869591Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:14:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:14:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:14:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:14:01.815025Z 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-08-03T06:14:01.827254Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:14:01.827284Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:14:01.838250Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:14:01.929735Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:14:02.836305Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:14:03.051822Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:14:03.052113Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:14:03.052150Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:14:03.053717Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:14:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:14:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:14:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:14:09.708213Z 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-08-03T06:14:09.718157Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:14:09.718187Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:14:09.728521Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:14:09.785854Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:14:10.556984Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:14:10.847891Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:14:10.848129Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:14:10.848165Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:14:10.849647Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:14:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:14:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:14:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:14:20.807168Z 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-08-03T06:14:20.819200Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:14:20.819231Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:14:20.829042Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:14:20.904475Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:14:21.745379Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:14:22.019620Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:14:22.020038Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:14:22.020116Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:14:22.021569Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:14:37+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:14:37+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:14:37+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:14:38.336495Z 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-08-03T06:14:38.346879Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:14:38.346910Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:14:38.355982Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:14:38.401038Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:14:39.439981Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:14:39.688466Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:14:39.688836Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:14:39.688881Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:14:39.690256Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:15:07+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:15:08+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:15:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:15:08.812491Z 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-08-03T06:15:08.824051Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:15:08.824083Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:15:08.835330Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:15:08.884074Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:15:09.598467Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:15:09.842765Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:15:09.843038Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:15:09.843109Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:15:09.844406Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:16:04+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:16:04+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:16:04+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:16:05.411826Z 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-08-03T06:16:05.422864Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:16:05.422895Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:16:05.437596Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:16:05.486536Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:16:06.235782Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:16:06.504590Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:16:06.504893Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:16:06.504965Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:16:06.506629Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:17:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:17:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:17:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:17:09.710388Z 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-08-03T06:17:09.725995Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:17:09.726036Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:17:09.738785Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:17:09.836029Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:17:10.640444Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:17:10.933443Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:17:10.933749Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:17:10.933812Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:17:10.935379Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:18:13+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:18:13+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:18:13+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:18:14.339873Z 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-08-03T06:18:14.355514Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:18:14.355556Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:18:14.367405Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2022-08-03T06:18:14.470999Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:18:15.216762Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:18:15.409546Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:18:15.409939Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:18:15.409979Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:18:15.412445Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:19:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:19:18+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:19:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:19:18.568091Z 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-08-03T06:19:18.582955Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:19:18.582987Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:19:18.596502Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:19:18.689140Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:19:19.579966Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:19:19.845619Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:19:19.845948Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:19:19.846001Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:19:19.847771Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:20:22+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:20:22+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:20:22+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:20:23.335838Z 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-08-03T06:20:23.346428Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:20:23.346459Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:20:23.358021Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:20:23.442383Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:20:24.334394Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:20:24.581742Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:20:24.582067Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:20:24.582145Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:20:24.583429Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
2022-08-03 06:21:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
2022-08-03 06:21:27+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-08-03 06:21:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2022-08-03T06:21:27.858128Z 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-08-03T06:21:27.871861Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-08-03T06:21:27.871891Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-08-03T06:21:27.886573Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive    
2022-08-03T06:21:27.937394Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T06:21:28.781122Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-08-03T06:21:29.056997Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T06:21:29.057329Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T06:21:29.057392Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T06:21:29.058769Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.

我不知道这些日志是否有意义,但我可以看到在最后一行它说Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
当我试图连接到这个mysql服务器上的docker,这里是我得到的错误.

"There was an error processing your request: connect ECONNREFUSED 127.0.0.1:8080"

可能我漏掉了一些小东西,可能是什么原因。

7gs2gvoe

7gs2gvoe1#

这是因为数据文件夹在建筑物中间的第一次安装或升级过程中损坏或没有正确关闭。

尝试此步骤

尝试删除Docker图像。列出所有图像使用

docker images

删除MySQL映像

docker rmi imagename

更新:不要忘记删除Docker卷

查找卷

docker volume ls

删除卷

docker volume rm volumename

另外,转到目录C:/Users/crisp/OneDrive/Desktop/html/database并删除该文件夹。

用于移除未使用的容器

docker system prune -a

然后尝试docker-compose up进行调试。如果没有错误,则可以尝试docker-compose up -d

e37o9pze

e37o9pze2#

输出中的错误为:
2022-08- 03 T06:21:28.781122Z 1 [错误] [MY-012960] [InnoDB]无法创建重做日志文件,因为数据文件已损坏或数据库在创建数据文件后未完全关闭。
不要将Windows文件夹装载到用于mysql数据存储的Linux容器中:

volumes:
  - ./db/init.sql:/docker-entrypoint-initdb.d/0_init.sql
  - C:/Users/crisp/OneDrive/Desktop/html/database:/var/lib/mysql

使用命名卷,以便文件系统位于运行Docker的虚拟机本地

volumes:
      - ./db/init.sql:/docker-entrypoint-initdb.d/0_init.sql
      - todo_db:/var/lib/mysql

volumes:
  todo_db: {}

当你这样做的时候,数据库会回到一个初始的空白状态。如果有重要的东西在那里,从备份恢复数据库。

相关问题