Difference between revisions of "Docker install of mysql"
From MyWiki
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Reference:''' https://hub.docker.com/_/mysql <br> | '''Reference:''' https://hub.docker.com/_/mysql <br> | ||
+ | <source lang="bash"> | ||
+ | docker run --name mysql-8 -e MYSQL_ROOT_PASSWORD=<password> -d mysql:8.0.33 | ||
+ | docker inspect mysql-8 | ||
+ | </source> | ||
+ | Note, below the "mysql" directory must be created before running the command | ||
+ | <source lang="bash"> | ||
+ | docker run --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d --mount type=bind,source="$(pwd)"/mysql,target=/var/lib/mysql mysql:latest | ||
+ | </source> | ||
+ | With the following syntax the "mysql" directory gets created automatically | ||
+ | <source lang="bash"> | ||
+ | docker run --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d -v "$(pwd)"/mysql:/var/lib/mysql mysql:latest | ||
+ | </source> |
Latest revision as of 19:09, 31 July 2023
Reference: https://hub.docker.com/_/mysql
docker run --name mysql-8 -e MYSQL_ROOT_PASSWORD=<password> -d mysql:8.0.33 docker inspect mysql-8
Note, below the "mysql" directory must be created before running the command
docker run --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d --mount type=bind,source="$(pwd)"/mysql,target=/var/lib/mysql mysql:latest
With the following syntax the "mysql" directory gets created automatically
docker run --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d -v "$(pwd)"/mysql:/var/lib/mysql mysql:latest