Quick setup of a MySQL server with Docker

Published on 2019-02-12 • Modified on 2019-02-12

This is my first step to learn Docker in 2019 😊. This snippet comes from a Tweet of @pierstoval. I was bluffed as it was indeed really fast to use the produced container. I am now using it to load the dev data fixtures of this blog (they allow to run the unit and fonctionnal tests of the project). All I had to do in my Symfony .env file is to change the port from 3306 to 13306. Et voilà! 😉

PS: Of course you don't have to launch the first two lines the first time.


docker stop mysql_host
docker rm mysql_host
docker run --name=mysql_host -dit -e MYSQL_ROOT_PASSWORD=root --publish 13306:3306 mysql:5.7

 More on Stackoverflow  Random snippet

  Work with me!