Skip to content

Instantly share code, notes, and snippets.

@hicl
Forked from spalladino/mysql-docker.sh
Created January 31, 2025 09:17
Show Gist options
  • Save hicl/3b10bc0a237db97700c17d663c1d36bc to your computer and use it in GitHub Desktop.
Save hicl/3b10bc0a237db97700c17d663c1d36bc to your computer and use it in GitHub Desktop.
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@hicl
Copy link
Author

hicl commented Jan 31, 2025

a good feature for my "master of backup" idea

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