Fails to initialize MySQL database on Windows 10

前端 未结 4 928
花落未央
花落未央 2020-12-16 15:10

Using Laradock

System Info:

  • Docker version: 17.10.0-ce, build f4ffd25
  • OS: Windows 10 Home

When I run docker-compose up -d my

4条回答
  •  伪装坚强ぢ
    2020-12-16 15:45

    Disable AIO

    This fixed it for me when I got the AIO error as you did when I was starting a container from a guest Debian OS from Virtualbox and creating the database files on a shared folder on Windows 10.

    The issue seems to be that AIO is not supported on shared folders, or at least on some versions of Windows. It seems to have occurred for me after I moved from Windows 10 Pro to Home after my main machine crashed.

    For details:

    • aio
    • disable aio in MySQL for zfs

    Here are some options:

    Option 1 - start the container like this :

    docker run -it mysql --innodb_use_native_aio=0
    

    Option 2 - add the command to your docker-compose file:

     command: --innodb_use_native_aio=0
    

    In context, this is the relevant portion of my working 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
    

    Option 3 -- add an option to your my.cnf file in your build

    innodb_use_native_aio=0
    

    Option 4 - Don't persist your DB on the local file system.(Can destroy your db, Not Recommended)

    Simply remove the volume in your docker configuration that contains your mysql db. Of course, your DB will be deleted if you do a docker-compose down or otherwise destroy your container, so there's that.

提交回复
热议问题