grant privileges when deploy ui db
@@ -12,10 +12,13 @@ flyway="$base/tools/flyway-3.2.1/flyway"
flyway_sql="$base/tools/flyway-3.2.1/sql/"
mysql --user=$user --password=$password --host=$host --port=$port << EOF
+grant usage on *.* to 'root'@'localhost';
+grant usage on *.* to 'root'@'%';
DROP DATABASE IF EXISTS zstack_ui;
CREATE DATABASE zstack_ui;
grant all privileges on zstack_ui.* to root@'%' identified by "$password";
grant all privileges on zstack_ui.* to root@'localhost' identified by "$password";
+flush privileges;
EOF
rm -rf $flyway_sql
@@ -32,11 +35,10 @@ fi
hostname=`hostname`
mysql --user=$user --password=$password --host=$host --port=$port << EOF
-grant usage on *.* to 'zstack_ui';
-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'@'%';
+drop user zstack_ui;
+create user 'zstack_ui' identified by "$zstack_ui_db_password";
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";
