按照項目github文檔上所示,在使用 mysql 時你可能會這樣寫:
$ migrate -path db/migrations -database mysql://root:123456@127.0.0.1:3306/mydb version
-database 用於指定數據庫 DSN 格式的連接,每個驅動所支持的會不一樣,使用 mysql 參考如下格式:
mysql://user:password@tcp(host:port)/dbname?query
所以用法是 migrate -source "file://migration/scripts" -database "mysql://root@tcp(localhost:3306)/texo_ewallet_db" up
https://github.com/golang-migrate/migrate/issues/178