Skip to content

Instantly share code, notes, and snippets.

@OdinsHat
Forked from collymore/MageDbExport.sh
Last active August 29, 2015 14:18
Show Gist options
  • Save OdinsHat/4eb02ec8b1dd40dc4104 to your computer and use it in GitHub Desktop.
Save OdinsHat/4eb02ec8b1dd40dc4104 to your computer and use it in GitHub Desktop.
Run this one-liner in your Magento root to have the instaled DB dumped to the directory above with the filename the same as the dbname[.sql]
grep 'user\|dbname\|pass' app/etc/local.xml | tr -d '\n' | sed 's/<username><\!\[CDATA\[\(.*\)\]\]><\/username>.*<password><\!\[CDATA\[\(.*\)\]\]><\/password>.*<dbname><\!\[CDATA\[\(.*\)\]\]><\/dbname>/ mysqldump -u\1 -p\2 \3 > ..\/\3.sql/g' | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment