I have a docker-compose configuration as follows:
mysql:
image: mysql/mysql-server:8.0.23
ports:
- ${DOCKER_HOST_MYSQL_PORT:-3306}:3306
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: ${DB_DATABASE}
volumes:
- ./storage/docker/mysql:/var/lib/mysql
networks:
then I ran the following: docker-compose up mysql
I'm getting the following error:
[+] Running 5/5
⠿ mysql Pulled 14.1s
⠿ 517a40cb4717 Pull complete 5.9s
⠿ 4a26b26e2152 Pull complete 10.0s
⠿ 14794e2450ed Pull complete 10.0s
⠿ 754b01a0f0ff Pull complete 10.0s
[+] Running 1/1
⠿ Container client-app-mysql-1 Recreated 0.4s
Attaching to client-app-mysql-1
client-app-mysql-1 | [Entrypoint] MySQL Docker Image 8.0.23-1.1.19
client-app-mysql-1 | [Entrypoint] Starting MySQL 8.0.23-1.1.19
client-app-mysql-1 | 2022-03-29T08:41:12.591047Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 26
client-app-mysql-1 | 2022-03-29T08:41:12.597713Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
client-app-mysql-1 | 2022-03-29T08:41:12.611927Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
client-app-mysql-1 | 2022-03-29T08:41:12.612425Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
client-app-mysql-1 | 2022-03-29T08:41:13.343343Z 1 [ERROR] [MY-012224] [InnoDB] Tablespace flags are invalid in datafile: ./ibdata1, Space ID:0, Flags: 21. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
client-app-mysql-1 | 2022-03-29T08:41:13.344157Z 1 [ERROR] [MY-012237] [InnoDB] Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
client-app-mysql-1 | 2022-03-29T08:41:13.344888Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Data structure corruption.
client-app-mysql-1 | 2022-03-29T08:41:13.833188Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
client-app-mysql-1 | 2022-03-29T08:41:13.835836Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
client-app-mysql-1 | 2022-03-29T08:41:13.837260Z 0 [ERROR] [MY-010119] [Server] Aborting
client-app-mysql-1 | 2022-03-29T08:41:13.838870Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
client-app-mysql-1 exited with code 1
I got into the same problem once moved to a M1 machine. Didn't dig much into the issue, but got it working by attaching a docker volume and in this way the DB data are persistent
version: '3.7'
services:
dcm-mysql:
hostname: dcm-mysql
container_name: dcm-mysql
image: mysql:8.0.29-oracle
restart: always
environment:
MYSQL_DATABASE: dcm
MYSQL_USER: dcm
MYSQL_PASSWORD: dcm
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
volumes:
# - ../local_data/mdb/data:/var/lib/mysql
- dcm-mysql-data:/var/lib/mysql
networks:
- mariadb
volumes:
dcm-mysql-data:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.