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/
π Connect with Me
Thanks for reading! If you found this post helpful or want to discuss similar topics in full stack development, feel free to connect or reach out:
π LinkedIn: https://www.linkedin.com/in/sarvesh-sp/
π Portfolio: https://sarveshsp.netlify.app/
π¨ Email: sarveshsp@duck.com
Found this article useful? Consider sharing it with your network and following me for more in-depth technical content on Node.js, performance optimization, and full-stack development best practices.
Top comments (0)