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"

主從版

相關文章
相關標籤/搜索