TiProxy is incompatible with go-sql-driver 1.3.0
Open
Nobody has claimed this yet.
wontfix
- Dominant language
- Go
- Stars
- 73
- Forks
- 41
- Avg merge
- 21h 3m
- Merged PRs (30d)
- 21
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
- Start TiDB and TiProxy
- Connect to TiProxy with go 1.3.0
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
func main() {
mdb, err := sql.Open("mysql", "root@tcp(localhost:6001)/test")
if err != nil {
panic(err)
}
err = mdb.Ping()
if err != nil {
panic(err)
}
}
2. What did you expect to see? (Required)
No error
3. What did you see instead (Required)
Driver reports this user requires mysql native password authentication.
4. What is your version? (Required)
master.
The reason:
- Go-sql-driver sends the auth packet with
mysql_native_password. But when TiProxy requests to switch auth method tomysql_native_password, go-sql-driver just reportsErrNativePassword. See https://github.com/go-sql-driver/mysql/blob/v1.3.0/packets.go#L495-L497. I think there's no way to avoid this problem on TiProxy side. - Connecting to TiDB directly doesn't have this problem because TiDB won't send a switch auth request in this case.
- Go-sql-driver 1.4.0 works well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure by starting TiDB and TiProxy, then connecting with go-sql-driver/mysql 1.3.0 using the example in the issue. Read go-sql-driver/mysql v1.3.0 packets.go around lines 495-497 and compare the authentication handshake with version 1.4.0; done means the compatibility problem and a project-owned fix path are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100