diff --git a/AUTHORS b/AUTHORS index 861905d23..4702c83ab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ oscarzhao Paul Bonser Peter Schultz Rebecca Chin +Reed Allman Runrioter Wung Robert Russell Shuode Li diff --git a/packets.go b/packets.go index 4e66639c4..18251aaf1 100644 --- a/packets.go +++ b/packets.go @@ -157,6 +157,11 @@ func (mc *mysqlConn) writePacket(data []byte) error { func (mc *mysqlConn) readInitPacket() ([]byte, error) { data, err := mc.readPacket() if err != nil { + // for init we can rewrite this to ErrBadConn for sql.Driver to retry, since + // in connection initialization we don't risk retrying non-idempotent actions. + if err == ErrInvalidConn { + return nil, driver.ErrBadConn + } return nil, err }