无法在Windows 10上初始化MySQL数据库

Using Laradock

System Info:

  • Docker版本:17.10.0-ce,构建f4ffd25
  • OS:Windows 10" title="Windows 10">Windows 10 Home

When I run docker-compose up -d mysql 遇到错误。以下是

docker日志

[Note] Basedir set to /usr/

[Warning] The syntax ‘–symbolic-links/-s’ is deprecated and will be removed

in a future release

[Warning] ‘NO_ZERO_DATE’, ‘NO_ZERO_IN_DATE’ and ‘ERROR_FOR_DIVISION_BY_ZERO’

sql modes should be used with strict mode. They will be merged with strict

mode in a future release.

[ERROR] –initialize specified but the data directory has files in it.

Aborting.

[ERROR] Aborting

I have tried deleting mysql folder under ~/.laradock\data and didn’t work.

mysql:

build:

context: ./mysql

args:

- MYSQL_VERSION=${MYSQL_VERSION}

environment:

- MYSQL_DATABASE=${MYSQL_DATABASE}

- MYSQL_USER=${MYSQL_USER}

- MYSQL_PASSWORD=${MYSQL_PASSWORD}

- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}

- TZ=${WORKSPACE_TIMEZONE}

volumes:

- ${DATA_SAVE_PATH}/mysql:/var/lib/mysql

- ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d

ports:

- "${MYSQL_PORT}:3306"

networks:

- backend

ARG MYSQL_VERSION=8.0

FROM mysql:${MYSQL_VERSION}

MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>

#####################################

# Set Timezone

#####################################

ARG TZ=UTC

ENV TZ ${TZ}

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN chown -R mysql:root /var/lib/mysql/

ADD my.cnf /etc/mysql/conf.d/my.cnf

CMD ["mysqld"]

EXPOSE 3306

After I delete mysql folder under ~/.laradock/data 出现以下错误。命令后,它将在下图中生成文件。当我重新运行时

,返回上面提到的先前的错误。

[Note] Basedir set to /usr/

[Warning] The syntax ‘–symbolic-links/-s’ is deprecated and will be removed

in a future release

[Warning] ‘NO_ZERO_DATE’, ‘NO_ZERO_IN_DATE’ and ‘ERROR_FOR_DIVISION_BY_ZERO’

sql modes should be used with strict mode. They will be merged with strict

mode in a future release.

[Warning] Setting lower_case_table_names=2 because file system for

/var/lib/mysql/ is case insensitive

[Warning] You need to use –log-bin to make –log-slave-updates work.

libnuma: Warning: /sys not mounted or invalid. Assuming one node: No such

file or directory mbind: Operation not permitted

[ERROR] InnoDB: Operating system error number 22 in a file operation.

[ERROR] InnoDB: Error number 22 means ‘Invalid argument’

[ERROR] InnoDB: File ./ib_logfile101: ‘aio write’ returned OS error 122.

Cannot continue operation

[ERROR] InnoDB: Cannot continue operation.

我在Windows 7机器上尝试了它的工作原理。

回答:

回答:

这就像我从Virtualbox的来宾Debian OS 启动容器并在Windows 10的共享文件夹上创建数据库文件时遇到的AIO错误一样,为我解决了该问题。

问题似乎是共享文件夹或至少某些Windows版本不支持AIO 。

我的主机崩溃后,从Windows 10 Pro 迁移到家庭版后,对我来说似乎发生了这种情况。

有关详细信息:

  • aio
  • disable aio in MySQL for zfs

以下是一些选项::

docker run -it mysql --innodb_use_native_aio=0

 command: --innodb_use_native_aio=0

上下文中,这是我正在工作的docker-compose.yml的相关部分:

services:

db:

image: ${MYSQL_IMAGE}

command: "--innodb_use_native_aio=0"

volumes:

- ${DB_DATA_PATH}:/var/lib/mysql

ports:

- ${MYSQL_PORT}:3306

innodb_use_native_aio=0

只需在包含mysql

db的docker配置中删除该卷即可。当然,如果您做一个docker-compose或

破坏您的容器,您的数据库将被删除,就是这样。

以上是 无法在Windows 10上初始化MySQL数据库 的全部内容, 来源链接: utcz.com/qa/428312.html

回到顶部