Skip to content

Commit

Permalink
refactor: use root credentials to create database dump
Browse files Browse the repository at this point in the history
This fixes an issue introduced in mysql 8.0.32 where we now need RELOAD and PROCESS to make a dump. Since we already import via root, exporting via root should be fine as well.
  • Loading branch information
josegonzalez committed Mar 5, 2023
1 parent fce19e6 commit 9354d90
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ service_export() {
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local SERVICE_NAME="$(get_service_name "$SERVICE")"
local DATABASE_NAME="$(get_database_name "$SERVICE")"
local PASSWORD="$(service_password "$SERVICE")"
local ROOTPASSWORD="$(service_root_password "$SERVICE")"

[[ -n $SSH_TTY ]] && stty -opost
"$DOCKER_BIN" container exec "$SERVICE_NAME" bash -c "printf '[client]\ndefault-character-set=utf8mb4\npassword=$PASSWORD\n' > /root/credentials.cnf"
"$DOCKER_BIN" container exec "$SERVICE_NAME" mysqldump --defaults-extra-file=/root/credentials.cnf --user=mysql --single-transaction --no-tablespaces --quick "$DATABASE_NAME"
"$DOCKER_BIN" container exec "$SERVICE_NAME" rm /root/credentials.cnf
"$DOCKER_BIN" container exec "$SERVICE_NAME" mysqldump --default-character-set=utf8mb4 --user=root --password="$ROOTPASSWORD" --single-transaction --no-tablespaces --quick "$DATABASE_NAME"
status=$?
[[ -n $SSH_TTY ]] && stty opost
exit $status
Expand Down

0 comments on commit 9354d90

Please sign in to comment.