Merge "Missing commands to be added"
[oom.git] / kubernetes / so / components / so-mariadb / resources / config / docker-entrypoint-initdb.d / 02-create-requestdb.sh
1 #!/bin/sh
2 {{/*
3 #
4 # ============LICENSE_START==========================================
5 # ===================================================================
6 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
7 # ===================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #        http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END============================================
20 #
21 # ECOMP and OpenECOMP are trademarks
22 # and service marks of AT&T Intellectual Property.
23 #
24 */}}
25
26 echo "Creating requestdb database . . ." 1>/tmp/mariadb-requestdb.log 2>&1
27
28 mysql -uroot -p$MYSQL_ROOT_PASSWORD << EOF || exit 1
29 DROP DATABASE IF EXISTS requestdb;
30 CREATE DATABASE /*!32312 IF NOT EXISTS*/ requestdb /*!40100 DEFAULT CHARACTER SET latin1 */;
31 DROP USER IF EXISTS '${REQUEST_DB_USER}';
32 CREATE USER '${REQUEST_DB_USER}';
33 GRANT ALL on requestdb.* to '${REQUEST_DB_USER}' identified by '${REQUEST_DB_PASSWORD}' with GRANT OPTION;
34 FLUSH PRIVILEGES;
35 EOF
36
37 echo "Created requestdb database . . ." 1>>/tmp/mariadb-requestdb.log 2>&1