https://hub.docker.com/_/mysql/
- Dump using
mysqlpump.
$ mysqlpump -h your.host.db.com -u user_name -p --skip-definer --set-gtid-purged=OFF database_name > my_dump_file.sql
- Restore
-
If you wanna change the name from Production to Dev environment replace all ocurrence of production database name in dump file.
-
Using
nano$ nano my_dump_file.sql- Press
ctrl+\to open replace menu. - Digit production database name and press
enter. - Digit the new database name and press
enter. - To replace all ocurrences press
A (All) - Save (ctrl+S) and exit (ctrl+X)
- Press
-
-
After that run the restore
$ docker exec -i some-mysql-container sh -c 'exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD"' < /some/path/on/your/host/dump_file.sql
- Verify
$ docker exec -it some-mysql-container mysql -u user_name -pyour_password' -h localhost local_database_name
make some queries to the database and verify that the dump is ok