Is it possible from within a bash script to check if a mysql database exists. Depending on the result then perform another action or terminate the script?
Following command should do the trick for both the cases,
mysqlshow "DB_NAME" &> /dev/null && echo "YES" || echo "NO"