我正在使用 Docker 和 Docker Compose 运行一个 MySQL 容器。除了 MySQL,我的设置还包括 Apache/PHP 服务器和 PHPmyadmin,它们都是使用 Docker Compose 创建的同一个多容器应用程序的一部分。
我已经使用这个设置几个月了,直到最近一切都运行良好。由于某种原因,MySQL 容器不断启动和重新启动,这让我无法访问我的数据库。
这是执行日志:
2023-03-27 22:31:19 2023-03-27 21:31:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-03-27 22:31:20 2023-03-27 21:31:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-03-27 22:31:20 2023-03-27 21:31:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-03-27 22:31:21 '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2023-03-27 22:31:21 2023-03-27T21:31:21.723016Z 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.
2023-03-27 22:31:21 2023-03-27T21:31:21.744146Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-03-27 22:31:21 2023-03-27T21:31:21.744174Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32) starting as process 1
2023-03-27 22:31:21 2023-03-27T21:31:21.809687Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-27 22:31:23 2023-03-27T21:31:23.338669Z 1 [ERROR] [MY-013893] [InnoDB] Found existing redo log files, but at least one is missing. It is unknown if recovery could reach physically consistent state. Please consider restoring from backup or providing --innodb-force-recovery > 0.
2023-03-27 22:31:23 2023-03-27T21:31:23.338765Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2023-03-27 22:31:23 2023-03-27T21:31:23.721887Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2023-03-27 22:31:23 2023-03-27T21:31:23.722344Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2023-03-27 22:31:23 2023-03-27T21:31:23.722413Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-27 22:31:23 2023-03-27T21:31:23.724842Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
看来错误是由于缺少重做日志文件引起的,但是由于我对MySQL的经验相对不足,所以我不确定应该怎么做才能解决这个问题。我正在运行 Windows 11、Docker 4.17.1 和 MySQL 8.0.32。