docker安装mysql环境

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

单机版

安装

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/git

docker-compose:github

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"

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

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

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

缘由: https://github.com/boot2docker/boot2docker/issues/1300windows

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

解决:code

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"

主从版

相关文章
相关标签/搜索