Created
September 2, 2017 14:53
-
-
Save korniychuk/d73f1c6b851066cc194a3d6fe2af8629 to your computer and use it in GitHub Desktop.
check if mysql database exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hasDatabase() { | |
DB_NAME=$1; | |
return $(MYSQL_PWD="${MYSQL_ROOT_PASSWORD}" mysql -u${DB_USER} --skip-column-names --batch -e "SHOW DATABASES LIKE '${DB_NAME}'" | wc -l) | |
} |
Author
korniychuk
commented
Sep 2, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment