Skip to content

Instantly share code, notes, and snippets.

@marcelodeandrade
Last active September 21, 2022 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelodeandrade/e0687f0d44f61753622f67a33eb5dc11 to your computer and use it in GitHub Desktop.
Save marcelodeandrade/e0687f0d44f61753622f67a33eb5dc11 to your computer and use it in GitHub Desktop.
Backup n' Restore MySQL on Docker
# Backup
docker exec -i DOCKER_CONTAINER_ID /usr/bin/mysql --user=root --password=root -h 127.0.0.1 DATABASE > backup.sql
# Restore
docker exec -i DOCKER_CONTAINER_ID /usr/bin/mysql --user=root --password=root -h 127.0.0.1 < backup.sql
docker exec -i $(docker ps -qf "name=superlogica-mysql") /usr/bin/mysql --user=root --password=root -h 127.0.0.1 < backup.sql
@celosauro
Copy link

celosauro commented Jul 4, 2019

CREATE DATABASE `xxx-001`;
USE `xxx-001`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment