Skip to content

Commit

Permalink
Fix mysql password warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Feb 18, 2017
1 parent cbe37be commit 113e732
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ case "$1" in

logMsg "Starting MySQL backup..."
MYSQL_ROOT_PASSWORD=$(dockerExecMySQL printenv MYSQL_ROOT_PASSWORD)
dockerExecMySQL mysqldump -h mysql -u root -p"${MYSQL_ROOT_PASSWORD}" --opt --single-transaction --events --all-databases --routines --comments | bzip2 > "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}"
dockerExecMySQL sh -c "MYSQL_PWD=\"${MYSQL_ROOT_PASSWORD}\" mysqldump -h mysql -uroot --opt --single-transaction --events --all-databases --routines --comments" | bzip2 > "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}"
logMsg "Finished"
else
echo " * Skipping mysql backup, no such container"
Expand Down
4 changes: 2 additions & 2 deletions bin/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ case "$1" in
if [ -f "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}" ]; then
logMsg "Starting MySQL restore..."
MYSQL_ROOT_PASSWORD=$(dockerExecMySQL printenv MYSQL_ROOT_PASSWORD)
bzcat "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}" | dockerExecMySQL mysql -h mysql -u root -p"${MYSQL_ROOT_PASSWORD}"
echo "FLUSH PRIVILEGES;" | dockerExec mysql -h mysql -u root -p"${MYSQL_ROOT_PASSWORD}"
bzcat "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}" | dockerExecMySQL sh -c "MYSQL_PWD=\"${MYSQL_ROOT_PASSWORD}\" mysql -h mysql -uroot"
echo "FLUSH PRIVILEGES;" | dockerExec sh -c "MYSQL_PWD=\"${MYSQL_ROOT_PASSWORD}\" mysql -h mysql -uroot"
logMsg "Finished"
else
errorMsg "MySQL backup file not found"
Expand Down

0 comments on commit 113e732

Please sign in to comment.