Matej Perina | e385a7a | 2019-04-03 09:17:40 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | ### |
| 4 | # ============LICENSE_START======================================================= |
| 5 | # openECOMP : SDN-C |
| 6 | # ================================================================================ |
| 7 | # Copyright (C) 2017 AT&T Intellectual Property. All rights |
| 8 | # reserved. |
| 9 | # ================================================================================ |
| 10 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | # you may not use this file except in compliance with the License. |
| 12 | # You may obtain a copy of the License at |
| 13 | # |
| 14 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | # |
| 16 | # Unless required by applicable law or agreed to in writing, software |
| 17 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | # See the License for the specific language governing permissions and |
| 20 | # limitations under the License. |
| 21 | # ============LICENSE_END========================================================= |
| 22 | ### |
| 23 | |
| 24 | CCSDK_HOME=${CCSDK_HOME:-/opt/onap/ccsdk} |
| 25 | MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} |
| 26 | |
| 27 | SDNC_DB_USER=${SDNC_DB_USER:-sdnctl} |
| 28 | SDNC_DB_PASSWD=${SDNC_DB_PASSWD:-gamma} |
| 29 | SDNC_DB_DATABASE=${SDN_DB_DATABASE:-sdnctl} |
| 30 | |
| 31 | |
| 32 | # Create tablespace and user account |
| 33 | mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql <<-END |
| 34 | CREATE DATABASE ${SDNC_DB_DATABASE}; |
| 35 | CREATE USER '${SDNC_DB_USER}'@'localhost' IDENTIFIED BY '${SDNC_DB_PASSWD}'; |
| 36 | CREATE USER '${SDNC_DB_USER}'@'%' IDENTIFIED BY '${SDNC_DB_PASSWD}'; |
| 37 | GRANT ALL PRIVILEGES ON ${SDNC_DB_DATABASE}.* TO '${SDNC_DB_USER}'@'localhost' WITH GRANT OPTION; |
| 38 | GRANT ALL PRIVILEGES ON ${SDNC_DB_DATABASE}.* TO '${SDNC_DB_USER}'@'%' WITH GRANT OPTION; |
| 39 | commit; |
| 40 | END |
| 41 | |
| 42 | if [ -f ${CCSDK_HOME}/data/odlsli.dump ] |
| 43 | then |
| 44 | mysql -h dbhost -u root -p${MYSQL_PASSWD} sdnctl < ${CCSDK_HOME}/data/odlsli.dump |
| 45 | fi |