I am using a Github Actions pipeline and starting a mysql server using docker within that pipeline. I am attemtping to run a show tables command, however the output is being suppressed.
In the below pipeline i have a docker-compose file which runs a mysql server. Then i am attempting to connect to it and output the tables. However i never receive the output.
pipeline.yml
name: test-pipeline
on: [ push ]
jobs:
test:
name: Test Migration
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12'
- name: Setup
run: |
docker-compose -f CI/docker-compose.yml up -d
npm install
- name: Check tables
run: |
mysql --host=127.0.0.1 --protocol=tcp --user=root --password=password testDB -e "show tables;"
echo "here"
If anyone else comes across this problem i fixed it by not specifying the db upfront in the options, instead specifying the database in the -e command.
mysql --host=127.0.0.1 --protocol=tcp --user=root --password=password -e "show databases; use testDB; show tables;"