Docker install MySQL study notes

https://www.runoob.com/docker/docker-install-mysql.html

 

#docker search mysql

#docker pull mysql:5.6

#docker images |grep mysql

#docker run -p 3306: 3306 --name mysql56 -v $ PWD / conf: /etc/mysql/conf.d -v $ PWD / logs: / logs -v $ PWD / data: / var / lib / mysql - e MYSQL_ROOT_PASSWORD = mysql -d mysql: 5.6
command Description:
-p 3306: 3306: 3306 mapped to port 3306 of container port on the computer.
-v $ PWD / conf: /etc/mysql/conf.d: the conf / my.cnf under the current directory is mounted to the host vessel /etc/mysql/my.cnf.
-v $ PWD / logs: / logs : the logs directory under the current directory is mounted to the host container / logs.
-v $ PWD / data: / var / lib / mysql: a data directory of the host current directory is mounted to the container / var / lib / mysql.
-e MYSQL_ROOT_PASSWORD = mysql: initialize the root user's password.

#docker ps

#docker exec -it mysql56 bash

/#mysql -u root -p

Guess you like

Origin www.cnblogs.com/coffee_cn/p/11720928.html