Skip to content

Commit e915def

Browse files
committed
安装MySQL过程中测试MySQL是否能够连接后关闭连接
1 parent 3b61871 commit e915def

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/web/actions/default/setup/mysql/mysqlinstallers/mysql_installer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,12 @@ func (this *MySQLInstaller) InstallFromFile(xzFilePath string, targetDir string)
344344

345345
// waiting for startup
346346
for i := 0; i < 30; i++ {
347-
_, err = net.Dial("tcp", "127.0.0.1:3306")
347+
var conn net.Conn
348+
conn, err = net.Dial("tcp", "127.0.0.1:3306")
348349
if err != nil {
349350
time.Sleep(1 * time.Second)
350351
} else {
352+
_ = conn.Close()
351353
break
352354
}
353355
}

0 commit comments

Comments
 (0)