Created
July 23, 2018 09:26
-
-
Save venkat-bitla/d2e6c708421087ce2be014cf0067c398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a simple way of importing MySQL database in Docker. | |
In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance. | |
Put the exported sql file in the shared folder. | |
Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash. | |
Login to MySQL via mysql -u USERNAME -p. | |
While in MySQL CLI, create a database via create database DB_NAME;. | |
While in MySQL CLI, use the database you just created via use DB_NAME;. | |
While in MySQL CLI, import the sql file via source /path/to/file.sql. | |
Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment