MySQL via Docker

Command line to run MySQL va Docker

docker run -p 3306:3306 --name <unique name> -e MYSQL_ROOT_PASSWORD=<password> -d
  • -p is the port port number you are exposing to the outside world

  • --name the name you give this running instance (container), it must be unique within each host

  • -e create an environment variable that is passed into the applications running within the container

  • -d run the container as a daemon process

Replace <…> with a user-defined value

Command to use

docker run -p 3306:3306 --name mysql-for_training -e MYSQL_ROOT_PASSWORD=ppp -d