summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate Hsuan <kate.hsuan@redhat.com>2020-10-08 17:32:00 +0000
committerKate Hsuan <kate.hsuan@redhat.com>2020-10-08 17:32:00 +0000
commite891f73bb69ef292562464102e29598b2fa01985 (patch)
tree7ec804af12970218144a9b003e8247f78749357f
parentbc84613309318c3483d88a2c0296de65624a1067 (diff)
[Datalake] Fix db check script for new version mysql command.1.1.0-datalake-handler-feeder
Issue-ID: DCAEGEN2-2286 Signed-off-by: Kate Hsuan <kate.hsuan@redhat.com> Change-Id: Ieea55b86581520a0813de35377c9090a4b0fb254
-rw-r--r--components/datalake-handler/feeder/src/assembly/init_db/scripts/db_init/10_check-db-exist7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/datalake-handler/feeder/src/assembly/init_db/scripts/db_init/10_check-db-exist b/components/datalake-handler/feeder/src/assembly/init_db/scripts/db_init/10_check-db-exist
index cdf8af50..4b2130a3 100644
--- a/components/datalake-handler/feeder/src/assembly/init_db/scripts/db_init/10_check-db-exist
+++ b/components/datalake-handler/feeder/src/assembly/init_db/scripts/db_init/10_check-db-exist
@@ -17,9 +17,10 @@
# limitations under the License.
# ============LICENSE_END============================================
#
-result=`mysql -qfsB -uroot -p$MYSQL_ROOT_PASSWORD -h $MYSQL_HOST -P $MYSQL_PORT -e "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='datalake'" 2>&1`
-if [[ ! -z $result ]];
+result=`mysql -uroot -p$MYSQL_ROOT_PASSWORD -h $MYSQL_HOST -P $MYSQL_PORT -e "USE 'datalake'"`
+
+if [ $? == 0 ] ;
then
echo "DATABASE ALREADY EXISTS"
touch /tmp/db_exist
@@ -27,4 +28,4 @@ then
else
echo "DATABASE DOES NOT EXIST"
exit 0
-fi \ No newline at end of file
+fi