【发布时间】:2019-09-20 03:23:02
【问题描述】:
我在 AWS AMI 上运行 docker,当我想使用 docker-compose 运行 mysql:8 容器时出现以下错误。我已经创建了这个容器需要的数据量。
我的 docker-compose 文件的片段是
version: '3.7'
services:
mysql:
image: mysql:8
command: bash -c "rm /etc/localtime && ln -s /usr/share/zoneinfo/America/New_York /etc/localtime && mysqld --user=root --default-authentication-plugin=mysql_native_password"
volumes:
- mysql-data:/var/lib/mysql
- ./:/home
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: example
...
mysql-data:
external:
name: data-volume
我收到以下错误,我不确定错误指的是哪个数据目录
mysql_1 | 2019-09-20T03:13:24.151141Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
mysql_1 | 2019-09-20T03:13:24.151148Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
mysql_1 | 2019-09-20T03:13:24.433348Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
mysql_1 | 2019-09-20T03:13:24.433434Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
mysql_1 | 2019-09-20T03:13:24.443292Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
mysql_1 | 2019-09-20T03:13:24.443383Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
mysql_1 | 2019-09-20T03:13:24.445787Z 0 [ERROR] [MY-010119] [Server] Aborting
mysql_1 | 2019-09-20T03:13:24.446197Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
【问题讨论】:
-
尝试添加
mysqld --user=root --default-authentication-plugin=mysql_native_password --ignore-db-dir=lost+found -
还有一些建议,从ENV设置时区,从ENV设置用户,删除命名卷尝试绑定卷,你也不需要绑定
home -
您的 mysql-data 是否事先正确定义?
标签: mysql amazon-web-services docker docker-compose amazon-ami