]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
clear and rebuild db scripts
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 22 Sep 2008 19:58:24 +0000 (15:58 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 22 Sep 2008 19:58:24 +0000 (15:58 -0400)
darcs-hash:20080922195824-5ed1f-f95ae048209e44e4de7698d98eb8a01121a2231d.gz

scripts/cleardb.sh [new file with mode: 0755]
scripts/rebuilddb.sh [new file with mode: 0755]

diff --git a/scripts/cleardb.sh b/scripts/cleardb.sh
new file mode 100755 (executable)
index 0000000..06690ed
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+export user=$1
+export password=$2
+export DB=$3
+export SCR=$4
+
+mysqladmin -u $user --password=$password -f drop $DB
+mysqladmin -u $user --password=$password create $DB
+mysql -u $user --password=$password $DB < $SCR
+
diff --git a/scripts/rebuilddb.sh b/scripts/rebuilddb.sh
new file mode 100755 (executable)
index 0000000..89bc6e2
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+export user=$1
+export password=$2
+export DB=$3
+export SCR=$4
+
+mysqldump -u $user --password=$password -c -t --hex-blob $DB > /tmp/$DB.sql
+mysqladmin -u $user --password=$password -f drop $DB
+mysqladmin -u $user --password=$password create $DB
+mysql -u $user --password=$password $DB < $SCR
+mysql -u $user --password=$password $DB < /tmp/$DB.sql
+
+