MySQL输出在管道中被抑制

时间:2020-07-08 14:55:33

标签: mysql github-actions

我正在使用Github Actions管道,并在该管道中使用docker启动mysql服务器。我正在尝试运行show tables命令,但是输出被抑制了。

enter image description here

在下面的管道中,我有一个运行mysql服务器的docker-compose文件。然后我尝试连接到它并输出表。但是我从来没有收到输出。

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"

1 个答案:

答案 0 :(得分:0)

如果还有其他人遇到此问题,我通过不在选项中预先指定db而是在-e命令中指定数据库来解决此问题。

mysql --host=127.0.0.1 --protocol=tcp --user=root --password=password -e "show databases; use testDB; show tables;"
相关问题