diff options
author | yangyan <yangyanyj@chinamobile.com> | 2019-04-03 11:02:53 +0800 |
---|---|---|
committer | Yan Yang <yangyanyj@chinamobile.com> | 2019-04-03 03:56:54 +0000 |
commit | be6150278ad87a1096df914954e76b99222b9eb8 (patch) | |
tree | a6769c8944803b2f690f4a4f92dc06b9e3df997a /resources | |
parent | 35448cd519979cf0a82320180dde121a88b6eb82 (diff) |
fix database bug
Change-Id: Ic96e3627b74f6be61710358777e2499f77a5c63a
Issue-ID: VFC-1334
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Diffstat (limited to 'resources')
-rw-r--r-- | resources/bin/initDB.sh | 6 | ||||
-rw-r--r-- | resources/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/resources/bin/initDB.sh b/resources/bin/initDB.sh index 3b277935..9d157283 100644 --- a/resources/bin/initDB.sh +++ b/resources/bin/initDB.sh @@ -25,10 +25,10 @@ sql_path=$HOME/../ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -P$MYSQL_PORT -h$MYSQL_IP <$sql_path/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql sql_result=$? if [ $sql_result -ne 0 ] ; then - echo "failed to create nfvocatalog database" + echo "Failed to create nfvocatalog database" exit 1 -elif [ $sql_result -eq 0 ]; then - echo "create nfvocatalog database successfully" +else + echo "Create nfvocatalog database successfully" exit 0 fi diff --git a/resources/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql b/resources/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql index a1fd3e2c..791bd7f5 100644 --- a/resources/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql +++ b/resources/dbscripts/mysql/vfc-nfvo-catalog-createdb.sql @@ -14,14 +14,11 @@ -- limitations under the License. -- -/******************drop old database and user***************************/ +/******************create database and user***************************/ use mysql; -drop database IF EXISTS nfvocatalog; -delete from user where User='nfvocatalog'; -FLUSH PRIVILEGES; -/******************create new database and user***************************/ -create database nfvocatalog CHARACTER SET utf8; +create database if not exists nfvocatalog CHARACTER SET utf8; + GRANT ALL PRIVILEGES ON nfvocatalog.* TO 'nfvocatalog'@'%' IDENTIFIED BY 'nfvocatalog' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON mysql.* TO 'nfvocatalog'@'%' IDENTIFIED BY 'nfvocatalog' WITH GRANT OPTION; |