summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@vps-18a7a2b7.vps.ovh.ca>2023-05-24 16:39:59 -0400
committerroot <root@vps-18a7a2b7.vps.ovh.ca>2023-05-24 16:40:26 -0400
commit53870be8b0eece765e941e8851e9109dd135ef26 (patch)
tree5d008518fa4dec32f512873eca0393ec820b24c7
parentaf2d8a50ad8ecc20dfed8cc1948e9ebd785b023e (diff)
wordpress-mysql: use remote mysql to check db existence
-rwxr-xr-xwordpress/wordpress-mysql10
1 files changed, 9 insertions, 1 deletions
diff --git a/wordpress/wordpress-mysql b/wordpress/wordpress-mysql
index 6a56bbb..a9b0d21 100755
--- a/wordpress/wordpress-mysql
+++ b/wordpress/wordpress-mysql
@@ -8,7 +8,15 @@ read_config()
8 8
9have_database() 9have_database()
10{ 10{
11 mysql -ss -e "show databases where \`database\` = '${db_name//\'/\'\'}'" | (read match && [ "$match" ]) 11 if [ "$DO_NOT_USE_SSH" ]
12 then
13 set -- mysql --host="$db_host"
14 else
15 set -- ssh "$db_host" -- mysql
16 fi
17 "$@" -ss <<END | (read match && [ "$match" ])
18show databases where \`database\` = '${db_name//\'/\'\'}'
19END
12} 20}
13 21
14create_new_mysql_database() 22create_new_mysql_database()