Failed to connect to mysql, er:dial tcp 127.0.0.1:3306
来源:3-1 Docker入门基础文档

cpen5
2019-06-24
请问我的主重能运行,但这行代码db, _ = sql.Open(“mysql”, “root:root@tcp(127.0.0.1:3306)/fileserver?charset=utf8”)
Failed to connect to mysql, er:dial tcp 127.0.0.1:3306: connect: connection refused
已改了bind-address = 0.0.0.0
写回答
1回答
-
xiaomo
2019-06-25
同学你好,你是本机程序连接本地docker里的mysql吗?
先确认下mysql端口有没有开了, 比如linux下:
netstat -antup | grep 3306
00
相似问题