summaryrefslogtreecommitdiffstats
path: root/rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2016-01-09 09:31:41 +0000
committerJun Li <matthew.lijun@huawei.com>2016-01-10 05:45:18 +0000
commitacbeb20b51c12f5ea486640e0e2a4e2cb81712c3 (patch)
treee80c5283c5da48c37dcc347ad65b5506947f9e96 /rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh
parentd30740bb6c80729281453878eda29abc32549161 (diff)
Support run rubbos test mult times
Update Mysql configuration to support run test mult times JIRA: BOTTLENECK-24 Change-Id: I29f2b17be03b095e1af569a53bbbecf4f78ab005 Signed-off-by: QiLiang <liangqi1@huawei.com> (cherry picked from commit 7be8a9f58376fb3ef0b2f5ecde03edca0e80035a)
Diffstat (limited to 'rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh')
-rwxr-xr-xrubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh32
1 files changed, 31 insertions, 1 deletions
diff --git a/rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh b/rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh
index 551c9d7f..aac9cc01 100755
--- a/rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh
+++ b/rubbos/rubbos_scripts/1-1-1/scripts/MYSQL1_reset.sh
@@ -5,7 +5,37 @@ source set_bottlenecks_rubbos_env.sh
echo "RESETING MYSQL on $HOSTNAME"
# copy rubbos data files
-tar xzf $RUBBOS_TOP/$RUBBOS_DATA_TARBALL --directory=$MYSQL_HOME/data/rubbos
+#tar xzf $RUBBOS_TOP/$RUBBOS_DATA_TARBALL --directory=$MYSQL_HOME/data/rubbos
+cd $MYSQL_HOME
+bin/mysqld_safe&
+sleep 10
+/etc/init.d/mysql.server status
+
+echo "BEGIN RUBBOS DATABASE GIVE PRIVILEGES"
+cat << EOF | mysql -uroot
+
+DROP DATABASE IF EXISTS rubbos;
+
+CREATE DATABASE rubbos;
+
+GRANT ALL PRIVILEGES ON rubbos.* TO 'rubbos'@'%' \
+ IDENTIFIED BY 'rubbos';
+ flush privileges;
+GRANT ALL PRIVILEGES ON rubbos.* TO 'rubbos'@'localhost' \
+ IDENTIFIED BY 'rubbos';
+ flush privileges;
+EOF
+echo "END RUBBOS DATABASE GIVE PRIVILEGES"
+
+echo "BEGIN IMPORT SQL DATA $(date)"
+echo "software_home=$SOFTWARE_HOME"
+tar xzf $SOFTWARE_HOME/$RUBBOS_DATA_TARBALL --directory /tmp
+mysql -uroot rubbos < /tmp/$RUBBOS_DATA_SQL
+echo "END IMPORT SQL DATA $(date)"
+rm /tmp/$RUBBOS_DATA_SQL
+
+bin/mysqladmin shutdown
echo "DONE RESETING MYSQL on $HOSTNAME"
sleep 5
+