安装MySQL过程中测试MySQL是否能够连接后关闭连接

This commit is contained in:
GoEdgeLab
2024-04-28 11:41:07 +08:00
parent 1e5788dd12
commit 1ca93e9918

View File

@@ -344,10 +344,12 @@ func (this *MySQLInstaller) InstallFromFile(xzFilePath string, targetDir string)
// waiting for startup
for i := 0; i < 30; i++ {
_, err = net.Dial("tcp", "127.0.0.1:3306")
var conn net.Conn
conn, err = net.Dial("tcp", "127.0.0.1:3306")
if err != nil {
time.Sleep(1 * time.Second)
} else {
_ = conn.Close()
break
}
}