Skip to content

Instantly share code, notes, and snippets.

@luanpcweb
Forked from spalladino/mysql-docker.sh
Last active December 30, 2022 20:01
Show Gist options
  • Save luanpcweb/5b7de1d0b995cff2b8273fd43f6e817c to your computer and use it in GitHub Desktop.
Save luanpcweb/5b7de1d0b995cff2b8273fd43f6e817c to your computer and use it in GitHub Desktop.

Revisions

  1. luanpcweb revised this gist Dec 30, 2022. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,16 @@ pv $BACKUP | docker exec -i $CONTAINER /usr/bin/mysql -u $MARIA_DB_USER --passwo
    ## PORTGRESS

    # Backup
    docker exec -t CONTAINER pg_dumpall -c -U postgres > backup.sql
    docker exec -t CONTAINER pg_dump --schema-only -U postgres > structure.sql

    ## Only structure or with exclued table data

    docker exec -t docker_postgres pg_dump --schema-only -U postgres > structure.sql

    docker exec -t docker_postgres pg_dump postgres --exclude-table-data='public.sites_acessos' --exclude-table-data='public.views_e_cliques' --exclude-table-data='public.movimentacoes' -U postgres > bck.sql


    ###

    docker exec -i postgress_dev_upee /bin/bash -c "PGPASSWORD=upeetest2020 pg_dump --username postgres postgres" > backup.sql

  2. luanpcweb revised this gist Sep 5, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,7 @@ pv $BACKUP | docker exec -i $CONTAINER /usr/bin/mysql -u $MARIA_DB_USER --passwo
    # Backup
    docker exec -t CONTAINER pg_dumpall -c -U postgres > backup.sql

    docker exec -i postgress_dev_upee /bin/bash -c "PGPASSWORD=upeetest2020 pg_dump --username postgres postgres" > backup.sql

    # Restore
    cat your_dump.sql | docker exec -i CONTAINER psql -U postgres
  3. luanpcweb revised this gist Sep 5, 2022. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -6,3 +6,11 @@ cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root

    pv $BACKUP | docker exec -i $CONTAINER /usr/bin/mysql -u $MARIA_DB_USER --password=$MARIA_DB_PASS $MARIA_DB_NAME


    ## PORTGRESS

    # Backup
    docker exec -t CONTAINER pg_dumpall -c -U postgres > backup.sql

    # Restore
    cat your_dump.sql | docker exec -i CONTAINER psql -U postgres
  4. luanpcweb revised this gist Jul 28, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -4,3 +4,5 @@ docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > back
    # Restore
    cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

    pv $BACKUP | docker exec -i $CONTAINER /usr/bin/mysql -u $MARIA_DB_USER --password=$MARIA_DB_PASS $MARIA_DB_NAME

  5. Santiago Palladino created this gist Dec 22, 2015.
    6 changes: 6 additions & 0 deletions mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # 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