Skip to content

Instantly share code, notes, and snippets.

@darekmydlarz
Last active August 8, 2018 07:43
Show Gist options
  • Save darekmydlarz/d33ae53adf4e16820c0fcfe99e3dae86 to your computer and use it in GitHub Desktop.
Save darekmydlarz/d33ae53adf4e16820c0fcfe99e3dae86 to your computer and use it in GitHub Desktop.
Docker Commands

Start MySQL in a docker with volume mounted on the host and initial scripts

${PWD}/docker-entrypoint-initdb.d - contains initial scripts to be loaded on MySql startup

docker run --name mysql-1 \
    -itd -e MYSQL_ROOT_PASSWORD=password  \
    -e MYSQL_DATABASE:affiliate_dev \
    -p 127.0.0.1:3306:3306  \
    -v /Users/darek/docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d mysql:5.7.19

Connect to database with mysql commad line:

docker exec -t -i mysql-1 /bin/bash
mysql -uroot -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment