Skip to content

Commit 5b12210

Browse files
committed
Run mysql client inside mariadb container
1 parent d6dac18 commit 5b12210

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/itkdev-docker-compose

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ Commands:
193193
Use `$(itkdev-docker-compose sql:connect)` to open the
194194
database cli.
195195
196+
Execute a SQL query from the command line:
197+
198+
$(itkdev-docker-compose sql:connect) --table <<< 'SHOW TABLES'
199+
200+
Run a SQL script:
201+
202+
$(itkdev-docker-compose sql:connect) < query.sql
203+
196204
sql:log
197205
Log SQL queries sent to database.
198206
@@ -609,10 +617,8 @@ EOF
609617
;;
610618

611619
sql:connect)
612-
address=$(docker_compose port mariadb 3306)
613-
host=$(echo $address | cut -d: -f1)
614-
port=$(echo $address | cut -d: -f2)
615-
echo mysql --host=$host --port=$port --user=db --password=db db
620+
db_service=mariadb
621+
echo docker compose exec --no-TTY $db_service mysql --user=db --password=db db
616622
;;
617623

618624
sql:open)

0 commit comments

Comments
 (0)