Skip to content

Instantly share code, notes, and snippets.

@rame0
Forked from spalladino/mysql-docker.sh
Last active November 23, 2020 13:40
Show Gist options
  • Save rame0/9dfe6c878ff5310d79840d2b2110c9f9 to your computer and use it in GitHub Desktop.
Save rame0/9dfe6c878ff5310d79840d2b2110c9f9 to your computer and use it in GitHub Desktop.

Revisions

  1. rame0 revised this gist Nov 23, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    ## Backup
    #All
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
    #docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
    # Structure
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --no-data DATABASE > structure.sql
    # Data
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --no-create-info DATABASE > data.sql
    # Ignore tables
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --ignore-table=name_of_db.name_of_table DATABASE > ignore_tables.sql
    #docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --ignore-table=name_of_db.name_of_table DATABASE > ignore_tables.sql

    # Restore
    cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
  2. rame0 revised this gist Nov 23, 2020. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion mysql-docker.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    # Backup
    ## Backup
    #All
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
    # Structure
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --no-data DATABASE > structure.sql
    # Data
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --no-create-info DATABASE > data.sql
    # Ignore tables
    docker exec CONTAINER /usr/bin/mysqldump -u root --password=root --ignore-table=name_of_db.name_of_table DATABASE > ignore_tables.sql

    # Restore
    cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
  3. 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