Skip to content

Commit

Permalink
add column-statistics=0 to mysqldump commands
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Feb 18, 2022
1 parent 18e9b68 commit 8526330
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for elabctl

## Version 2.3.3

* Add `--column-statistics=0` to mysqldump command.

## Version 2.3.2

* Use `docker compose` for Docker version > 20.x and `docker-compose` otherwise.
Expand Down
6 changes: 3 additions & 3 deletions elabctl.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# https://www.elabftw.net
declare -r ELABCTL_VERSION='2.3.2'
declare -r ELABCTL_VERSION='2.3.3'

# default backup dir
declare BACKUP_DIR='/var/backups/elabftw'
Expand Down Expand Up @@ -55,7 +55,7 @@ function backup
local -r dumpfile="${BACKUP_DIR}/mysql_dump-${date}.sql"

# dump sql
docker exec "${ELAB_MYSQL_CONTAINER_NAME}" bash -c 'mysqldump -u$MYSQL_USER -p$MYSQL_PASSWORD -r dump.sql --no-tablespaces $MYSQL_DATABASE 2>&1 | grep -v "Warning: Using a password"' || echo ">> Containers must be running to do the backup!"
docker exec "${ELAB_MYSQL_CONTAINER_NAME}" bash -c 'mysqldump -u$MYSQL_USER -p$MYSQL_PASSWORD -r dump.sql --no-tablespaces --column-statistics=0 $MYSQL_DATABASE 2>&1 | grep -v "Warning: Using a password"' || echo ">> Containers must be running to do the backup!"
# copy it from the container to the host
docker cp "${ELAB_MYSQL_CONTAINER_NAME}":dump.sql "$dumpfile"
# compress it to the max
Expand Down Expand Up @@ -418,7 +418,7 @@ function mysql-backup
local -r dumpfile="${BACKUP_DIR}/mysql_dump-${date}.sql"

# dump sql
docker exec "${ELAB_MYSQL_CONTAINER_NAME}" bash -c 'mysqldump -u$MYSQL_USER -p$MYSQL_PASSWORD -r dump.sql --no-tablespaces $MYSQL_DATABASE 2>&1 | grep -v "Warning: Using a password"' || echo ">> Containers must be running to do the backup!"
docker exec "${ELAB_MYSQL_CONTAINER_NAME}" bash -c 'mysqldump -u$MYSQL_USER -p$MYSQL_PASSWORD -r dump.sql --no-tablespaces --column-statistics=0 $MYSQL_DATABASE 2>&1 | grep -v "Warning: Using a password"' || echo ">> Containers must be running to do the backup!"
# copy it from the container to the host
docker cp "${ELAB_MYSQL_CONTAINER_NAME}:dump.sql" "$dumpfile"
# compress it to the max
Expand Down

0 comments on commit 8526330

Please sign in to comment.