Today in Docker installed MySQL, is its own Docker pack.
The first new dockerfile content is as follows:
From Mysql:latest
Maintainer Abel.yang <527515025@qq.com>
LABEL descripttion= "This" the image is a for MAC to use MySQL "vendor=" Gi Thub "version=" latest "
run Apt-get update
run apt-get-y install vim
run usermod-u 1000 mysql
run mkdir- P/var/run/mysqld
Run Chmod-r 777/var/run/mysqld
Execute build command after new dockerfile:
Building Mirrors
Docker build-t Mysql/yang.
The build results are as follows:
Enter command to view results
Docker images
Start mirroring
First set up the local data storage address, the data store map to the local computer to prevent data loss. So create a Save data directory, the command is as follows:
After creating the data directory, the start Mirroring command is as follows.
Docker run-p 3309:3306--name mysqlyang-v ~/mysql/data:/var/lib/mysql-e mysql_root_password=123456-d Mysql/yang
-P 3,309:3,306 Maps Docker 3306 ports to native 3309 ports
V ~/mysql/data:/var/lib/mysql is the/mysql/data that maps the Docker/var/lib/mysql folder to this machine
-e mysql_root_password=123456 Enter password, MYSQL original password is 123456
(If you need to modify the password to execute the docker-exec-it container Id/bin/bash Enter the container to modify the password, you can modify it using the Docker commit container ID new name.) )
Once the container is started, it can be connected using a visual interface. Notice that the exposed port is 3309.
The above is a small set to introduce the Mac Docker install MySQL graphics and text tutorial, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!