Go语言入门心法(八): mysql驱动安装报错onnection failed

Go语言入门心法(八): mysql驱动安装报错onnection failed_第1张图片



Go语言入门心法(一): 基础语法

Go语言入门心法(二): 结构体

Go语言入门心法(三): 接口

Go语言入门心法(四): 异常体系

 Go语言入门心法(五): 函数

Go语言入门心法(六): HTTP面向客户端|服务端编程

Go语言入门心法(八): mysql驱动安装报错onnection failed

Go语言入门心法(九): 引入三方依赖

Go语言入门心法(十):Go语言操作MYSQL(CRUD)|事务处理

Go语言入门心法(十一): 文件处理



一: go语言安装mysql驱动报错 


安装最新版mysql驱动:

PS D:\program_file\go_workspace> go install github.com/go-sql-driver/mysql@latest

或者下载远程的mysql启动到本地

PS D:\program_file\go_workspace>go get github.com/go-sql-driver/mysql

报错信息:

go: github.com/go-sql-driver/mysql@latest: module github.com/go-sql-driver/mysql: Get "https://proxy.golang.org/github.com/go-sql-driver/mysql/@v/list": dial tcp [2404:6800:4012:3::2011]:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
 

二: 解决方案


PS D:\program_file\go_workspace> go env -w GOPROXY=https://goproxy.cn 

再次安装即可

PS D:\program_file\go_workspace> go install github.com/go-sql-driver/mysql@latest
go: downloading github.com/go-sql-driver/mysql v1.7.1
package github.com/go-sql-driver/mysql is not a main package 

Go语言入门心法(八): mysql驱动安装报错onnection failed_第2张图片

你可能感兴趣的:(golang,mysql,开发语言)