create user zstack_ui when deploy ui db
@@ -5,7 +5,7 @@ user="$1"
password="$2"
host="$3"
port="$4"
-zstack_user_password="$5"
+zstack_ui_db_password="$5"
base=`dirname $0`
flyway="$base/tools/flyway-3.2.1/flyway"
@@ -14,8 +14,8 @@ flyway_sql="$base/tools/flyway-3.2.1/sql/"
mysql --user=$user --password=$password --host=$host --port=$port << EOF
DROP DATABASE IF EXISTS zstack_ui;
CREATE DATABASE zstack_ui;
-grant all privileges on zstack.* to root@'%' identified by "$password";
-grant all privileges on zstack.* to root@'localhost' identified by "$password";
+grant all privileges on zstack_ui.* to root@'%' identified by "$password";
+grant all privileges on zstack_ui.* to root@'localhost' identified by "$password";
EOF
rm -rf $flyway_sql
@@ -32,10 +32,12 @@ fi
hostname=`hostname`
mysql --user=$user --password=$password --host=$host --port=$port << EOF
-grant usage on *.* to 'zstack'@'localhost';
-grant usage on *.* to 'zstack'@'%';
-grant all privileges on zstack_ui.* to zstack@'localhost' identified by "$zstack_user_password";
-grant all privileges on zstack_ui.* to zstack@'%' identified by "$zstack_user_password";
-grant all privileges on zstack_ui.* to zstack@"$hostname" identified by "$zstack_user_password";
+drop user zstack_ui;
+create user 'zstack_ui' identified by "$zstack_ui_db_password";
+grant usage on *.* to 'zstack_ui'@'localhost';
+grant usage on *.* to 'zstack_ui'@'%';
+grant all privileges on zstack_ui.* to zstack_ui@'localhost' identified by "$zstack_ui_db_password";
+grant all privileges on zstack_ui.* to zstack_ui@'%' identified by "$zstack_ui_db_password";
+grant all privileges on zstack_ui.* to zstack_ui@"$hostname" identified by "$zstack_ui_db_password";
flush privileges;
EOF
