summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'z-distfiles/scripts-gw-1.0/mysql-dump-all')
-rwxr-xr-xz-distfiles/scripts-gw-1.0/mysql-dump-all15
1 files changed, 15 insertions, 0 deletions
diff --git a/z-distfiles/scripts-gw-1.0/mysql-dump-all b/z-distfiles/scripts-gw-1.0/mysql-dump-all
new file mode 100755
index 0000000..6cbf58c
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/mysql-dump-all
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: mysql-dump-all mysql-root-pass /backup/dir"
+ echo
+ echo "Dumps all mysql databases into the given /backup/dir/"
+ exit 0
+fi
+
+DBS=`mysql -u root -p${1} -s -e 'show databases;' | grep -v 'Database'`
+
+for db in $DBS
+do
+ mysqldump -u root -p${1} ${db} > ${2}/${db}.sql
+done