问题描述
在Mac上安装Docker和laradock之后,我尝试使用以下命令启动Docker容器:
docker-compose up -d Nginx MysqL PHPmyadmin
我得到输出:
Starting laradock_MysqL_1 ... done
Starting laradock_docker-in-docker_1 ... done
Starting laradock_PHPmyadmin_1 ... done
Starting laradock_workspace_1 ... done
Starting laradock_PHP-fpm_1 ... done
Starting laradock_Nginx_1 ... done
看起来不错,但是由于某种原因MysqL崩溃了。当我尝试再次启动容器时,收到以下消息:
MysqL_1 | 2020-10-01T10:19:52.124915Z 1 [Warning] [MY-012579] [InnoDB] fallocate(25,FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,16384) returned errno: 22
MysqL_1 | 2020-10-01T10:19:52.143672Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
MysqL_1 | 2020-10-01T10:19:52.159801Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('2') and data dictionary ('0').
MysqL_1 | 2020-10-01T10:19:52.160778Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization Failed.
MysqL_1 | 2020-10-01T10:19:52.161607Z 0 [ERROR] [MY-010119] [Server] Aborting
MysqL_1 | 2020-10-01T10:19:52.795909Z 0 [System] [MY-010910] [Server] /usr/sbin/MysqLd: Shutdown complete (MysqLd 8.0.21) MysqL Community Server - GPL.
我尝试将"command: --lower_case_table_names=0"
添加到我的docker-compose文件中,但这似乎无济于事。
MysqL崩溃:
MysqL_1 | 2020-10-01 10:21:28+00:00 [ERROR] [Entrypoint]: MysqLd Failed while attempting to check config
MysqL_1 | command was: MysqLd --lower_case_table_names=0 --verbose --help
MysqL_1 | 2020-10-01T10:21:28.547104Z 0 [ERROR] [MY-010158] [Server] The server option 'lower_case_table_names' is configured to use case sensitive table names but the data directory is on a case-insensitive file system which is an unsupported combination. Please consider either using a case sensitive file system for your data directory or switching to a case-insensitive table name mode.
MysqL_1 | 2020-10-01T10:21:28.549273Z 0 [ERROR] [MY-010119] [Server] Aborting
解决方法
这很可能是由Docker更新至2.4引起的。参见:
Mysql not starting in a docker container on MacOS after docker update
,我的解决方案:
cmd
fsutil file setCaseSensitiveInfo "C:\Users\XXXXX\.laradock\data\mysql"
这将在Windows 10中将数据字典的lower_case_table_names从('0')更改为('2')。 XXXXX-您在Windows 10中的用户名
然后
docker-compose up mysql