2 # ============LICENSE_START=======================================================
4 # ================================================================================
5 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
21 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
22 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
23 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
25 APPC_DB_USER=${APPC_DB_USER:-appcctl}
26 APPC_DB_PASSWD=${APPC_DB_PASSWD:-appcctl}
27 APPC_DB_DATABASE=${SDN_DB_DATABASE:-appcctl}
30 # Create tablespace and user account
31 mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql <<-END
32 CREATE DATABASE ${APPC_DB_DATABASE};
33 CREATE USER '${APPC_DB_USER}'@'localhost' IDENTIFIED BY '${APPC_DB_PASSWD}';
34 CREATE USER '${APPC_DB_USER}'@'%' IDENTIFIED BY '${APPC_DB_PASSWD}';
35 GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'localhost' WITH GRANT OPTION;
36 GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'%' WITH GRANT OPTION;
40 if [ -f ${APPC_HOME}/data/appcctl.dump ]
42 mysql -h dbhost -u root -p${MYSQL_PASSWD} appcctl < ${APPC_HOME}/data/appcctl.dump
45 if [ -f ${APPC_HOME}/data/sdnctl.dump ]
47 mysql -h dbhost -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sdnctl.dump
50 if [ -f ${APPC_HOME}/data/sqlData.dump ]
52 mysql -h dbhost -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sqlData.dump