Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "mysqlrestore" command to restore dumps #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docker-files/vessel
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ if [ $# -gt 0 ]; then
echo "Error: This command can only be run while a MySQL container is running mysqld (mysql server)."
echo "This command cannot run the server and the mysql client at the same time."
fi

# If "mysqlrestore" is used, run mysql
# from our mysql container with pseudo-tty
# allocation disabled; this lets us restore
# dumps by piping a dump into the command.
# See https://stackoverflow.com/a/49724907/6541
elif [ "$1" == "mysqlrestore" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
$COMPOSE exec -T \
mysql \
bash -c 'MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysql -u root $MYSQL_DATABASE'
else
echo "Error: This command can only be run while a MySQL container is running mysqld (mysql server)."
fi

# If "ssh" is used, pass-thru to "ssh"
# inside a new container
Expand Down