Skip to content

Instantly share code, notes, and snippets.

@MikeiLL
Created September 5, 2017 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeiLL/34c995994333cc0abdc2ed44d2e890b2 to your computer and use it in GitHub Desktop.
Save MikeiLL/34c995994333cc0abdc2ed44d2e890b2 to your computer and use it in GitHub Desktop.
function dumpdb()
{
# source https://stackoverflow.com/a/46042938/2223106
# source https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb
local wkdir=`basename $PWD`
local container='echo ${wkdir}_my-wpdb_1'
docker exec ${container} mysqldump -uroot --password=password wordpress > backup.sql
}
function restoredb()
{
# source: https://unix.stackexchange.com/a/390365/68860
local wkdir=`basename $PWD`
local container="${wkdir}_my-wpdb_1"
cat backup.sql | docker exec -i ${container} /usr/bin/mysql -u root --password=dockerpass wordpress
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment