File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,14 @@ func (c *Conn) readInitialHandshake() error {
4242 return errors .Annotate (c .handleErrorPacket (data ), "read initial handshake error" )
4343 }
4444
45- if data [0 ] < MinProtocolVersion {
46- return errors .Errorf ("invalid protocol version %d, must >= 10" , data [0 ])
45+ if data [0 ] != ClassicProtocolVersion {
46+ if data [0 ] == XProtocolVersion {
47+ return errors .Errorf (
48+ "invalid protocol version %d, expected 10. " +
49+ "This might be X Protocol, make sure to connect to the right port" ,
50+ data [0 ])
51+ }
52+ return errors .Errorf ("invalid protocol version %d, expected 10" , data [0 ])
4753 }
4854 pos := 1
4955
Original file line number Diff line number Diff line change 11package mysql
22
33const (
4- MinProtocolVersion byte = 10
5- MaxPayloadLen int = 1 << 24 - 1
6- TimeFormat string = "2006-01-02 15:04:05"
4+ ClassicProtocolVersion byte = 10
5+ XProtocolVersion byte = 11
6+ MaxPayloadLen int = 1 << 24 - 1
7+ TimeFormat string = "2006-01-02 15:04:05"
78)
89
910const (
You can’t perform that action at this time.
0 commit comments