Skip to content

Instantly share code, notes, and snippets.

@distolma
Created April 16, 2022 14:06
Show Gist options
  • Select an option

  • Save distolma/6fdb2e158ef5fa3e173994b7ffbfa723 to your computer and use it in GitHub Desktop.

Select an option

Save distolma/6fdb2e158ef5fa3e173994b7ffbfa723 to your computer and use it in GitHub Desktop.
mysql_postgresql_backup.sh
# MySQL
## 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
#PostgreSQL
## Backup
docker exec -t CONTAINER pg_dumpall -c -U postgres > backup.sql
## Restore
cat backup.sql | docker exec -i CONTAINER psql -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment