2 回答

TA貢獻1796條經驗 獲得超10個贊
localhost 不是 MySQL 服務器將偵聽的主機;它是 MySQL 服務器所監聽的主機。它將以 的名稱提供mysql
。
此外,該命令env="root:rootroot@tcp(localhost:3306)/TESTDB"
在 shell 中設置一個局部變量。它不會影響環境變量。
設置環境變量
export
局部變量或者使用
variables
字典或專門為命令設置變量
go test
:
variables:
? # Set your variable here for all jobs ...
? env: root:rootroot@tcp(mysql:3306)/TESTDB?
before_script:
? # ... or export it here ...
? - export env=root:rootroot@tcp(mysql:3306)/TESTDB
test:
? services:
? ? - mysql:5.7
? variables:
? ? # ... or set it here for this job only ...
? ? env: root:rootroot@tcp(mysql:3306)/TESTDB
? script:
? ? # ... or set it here for the go command only
? ? - env=root:rootroot@tcp(mysql:3306)/TESTDB go test ./...
- 2 回答
- 0 關注
- 187 瀏覽
添加回答
舉報