Last active
February 28, 2018 01:56
-
-
Save spyesx/9a3bddece8ef65d15df7311b5a9a9e24 to your computer and use it in GitHub Desktop.
Dumps all mysql databases in separate files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't forget to replace **USER** and **PASS** twice. | |
# https://explainshell.com/explain?cmd=mysql+-s+-r+-u**USER**+-p**PASS**+-e+%27show+databases%27+-N+%7C+while+read+dbname%3B+do+mysqldump+-u**USER**+-p**PASS**+--complete-insert+--single-transaction+%22%24dbname%22+%3E+%22%24dbname%22.sql%3B+done | |
mysql -s -r -u**USER** -p**PASS** -e 'show databases' -N | while read dbname; do mysqldump -u**USER** -p**PASS** --complete-insert --single-transaction "$dbname" > "$dbname".sql; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment