golang安装mysql驱动报错“git“: executable file not found in %PATH% 处理

环境: win11
go版本: go1.16.13 windows/amd64
golang下载mysql驱动报错,执行 go get github.com/go-sql-driver/mysql
报错 “git”: executable file not found in %PATH%
按照百度全是找环境变量的问题,并没有解决这个报错,下面的方法能解决这个报错

PS C:\goproject\src\pingcaptest\class2> go get github.com/go-sql-driver/mysql
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/go-sql-driver/mysql: exec: "git": executable file not found in %PATH%


PS C:\goproject\src\pingcaptest\class2> go env -w GO111MODULE=on
PS C:\goproject\src\pingcaptest\class2>  $env:GO111MODULE = "on"
PS C:\goproject\src\pingcaptest\class2> $env:GOPROXY = "https://goproxy.cn"
PS C:\goproject\src\pingcaptest\class2> go get github.com/go-sql-driver/mysql
go: downloading github.com/go-sql-driver/mysql v1.6.0
go get: added github.com/go-sql-driver/mysql v1.6.0

参考地址:
https://goproxy.cn/

你可能感兴趣的:(golang,mysql,golang,数据库)