1 #*******************************************************************************
2 # Copyright 2016, Nokia Corporation.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #*******************************************************************************
22 echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
28 echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
34 echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
40 echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
45 echo "DB-INIT [vnfm_db] : START"
47 echo "start to create database and tables ... "
48 mysql -u$1 -p$2 -h$3 -P$4 <$(cd `dirname $0`; pwd)/db/mysql/db-schema.sql > myout_init_db.file 2>&1
51 echo "DB-INIT [vnfm_db] : FAILED !"
52 cat myout_init_db.file
56 echo "DB-INIT [vnfm_db] : PASSED"
58 echo "*************************************************************"
59 echo "CAUTION: Existing vnfm_db will be cleaned before"
60 echo "initializing the schema, so please take a back-up of it"
61 echo "before executing it next time."
62 echo "*************************************************************"