Fire Up your mysql in a Docker Container 🔥🔥

rex_10

crit3cal

Posted on January 31, 2023

Fire Up your mysql in a Docker Container 🔥🔥

Docker must be installed, before following these steps.

3 min Step...

  1. Setup volume to persist the data

    docker volume create mysql-volume

  2. Docker Run

    docker run --name deep -p 3307:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql

  3. List the running containers

    docker ps

  4. 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/

💖 💪 🙅 🚩
rex_10
crit3cal

Posted on January 31, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related