From 108a3d1e6322f9568f0a41d667172066599c2f2a Mon Sep 17 00:00:00 2001 From: Renoir Boulanger Date: Tue, 23 Sep 2025 10:51:17 -0400 Subject: [PATCH] chore add to dev.sh CLI mysql prompt into db container task Instead of using an external MariaDB/MySQL client, we can use the container's internal mysql client directly. Since it's a container for development, and WordPress instance expects only one database, we can assume that this won't do anything in other contexts. --- dev.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dev.sh b/dev.sh index bd9f07116..9794b1151 100755 --- a/dev.sh +++ b/dev.sh @@ -29,6 +29,7 @@ function _show_help { echo " nginx Execute a 'nginx' command in the 'Portal' container. All are passed to nginx." echo "" echo " Database:" + echo " db Enter 'mysql' client CLI to the default database to make queries." echo " db-shell Start a shell on the 'database' container." echo " db-dump Dump to standard output the database of the 'database' container." echo " db-execute Execute the SQL script from standard input on the database of the 'database' container." @@ -118,6 +119,19 @@ function wp-cli { _docker_compose exec -w /var/www/html portal wp "$@" } +function db { + database="$1" + if [[ -z "$database" ]]; then + database="climatedata" + fi + echo "Connecting to MySQL '${database}' database. This should only work in development mode" + echo "" + echo " Reminder: to exit, use CTRL+D key combination" + echo "" + + _docker_compose exec -it db mysql -p'root' "$database" +} + function db-shell { _docker_compose exec -it db bash }