docker安装mysql环境

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

github地址: https://github.com/grace-233/docker-config-file/tree/master/mysql

单机版

安装

docker pull mysql:5.7
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7

https://hub.docker.com/_/mysql/ https://hub.docker.com/r/library/mysql/

docker-compose:

version: '2'
services:
    mysql:
        image: mysql:5.6
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: 111111
        #volumes:
         #   - /e/docker/mysql5.6/datadir:/var/lib/mysql
        ports:
            - "3306:3306"

问题:貌似挂载了数据盘之后,启动报错。

windows下面挂载了数据盘之后,启动报错:File ./ib_logfile101: 'aio write' returned OS error 122

挂载了数据盘之后,docker启动报错:

docker安装mysql环境_第1张图片

原因: https://github.com/boot2docker/boot2docker/issues/1300

貌似使用Windows下面的docker才有这个问题,需要禁用掉aio.

解决:

version: '2'
services:
    mysql:
        image: mysql:5.6
        command: --default-authentication-plugin=mysql_native_password --innodb-flush-method=O_DSYNC --innodb-use-native-aio=0 --log_bin=ON
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: 111111
        volumes:
            - /e/docker/mysql5.6/datadir:/var/lib/mysql
        ports:
            - "3306:3306"

主从版

转载于:https://my.oschina.net/grace233/blog/2878138

你可能感兴趣的:(docker安装mysql环境)