crit3cal
Posted on January 31, 2023
Docker must be installed, before following these steps.
3 min Step...
-
Setup volume to persist the data
docker volume create mysql-volume
-
Docker Run
docker run --name deep -p 3307:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql
-
List the running containers
docker ps
-
Container shell access
docker exec -it deep mysql -u root -p
Some of the docker terminologies used
--name : name of the container.
-p : port forwarding , default mysql port is 3306
-v : setup volume to persist the data for the container.
-e : provide an environment variable.
-d : start the container in detached mode.
Please note that you have to give the same password we have defined to run the container (root)
For more, refer the mysql docker hub docs
https://hub.docker.com/_/mysql/
Posted on January 31, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.