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