Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients with mysql_native_password cannot connect to TiDB #33141

Closed
djshow832 opened this issue Mar 16, 2022 · 3 comments · Fixed by #33142
Closed

Clients with mysql_native_password cannot connect to TiDB #33141

djshow832 opened this issue Mar 16, 2022 · 3 comments · Fixed by #33142
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/critical sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.

Comments

@djshow832
Copy link
Contributor

djshow832 commented Mar 16, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

dbaddr := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8", "root", "", "127.0.0.1", 4000, "test")
mdb, err := sql.Open("mysql", dbaddr)
if err != nil {
    println("open error:", err.Error())
    return
}
err = mdb.Ping()
if err != nil {
    println("ping error:", err.Error())
    return
}
mdb.Close()

with

require github.com/go-sql-driver/mysql v1.3.0

Note: mysql v1.6.0 is OK.

2. What did you expect to see? (Required)

No error

3. What did you see instead (Required)

ping error: this user requires mysql native password authentication.

4. What is your TiDB version? (Required)

master

This is caused by https://github.com/pingcap/tidb/pull/32338/files#diff-412615e1c1d4c6ae11a7885a11c879778bf401e0967c9c13c4b9dfd1f13ed29aR900

if resp.Capability&mysql.ClientPluginAuth > 0 {              // Previously, there is another condition before it: resp.AuthPlugin != mysql.AuthNativePassword
	resp.AuthPlugin = mysql.AuthNativePassword
	authData, err := cc.authSwitchRequest(ctx, mysql.AuthNativePassword)
	if err != nil {
		return nil, err
	}
	return authData, nil
}
@djshow832 djshow832 added type/bug This issue is a bug. sig/sql-infra SIG: SQL Infra severity/critical labels Mar 16, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 16, 2022
@djshow832 djshow832 removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Mar 16, 2022
@djshow832
Copy link
Contributor Author

I prefer to revert it for now because it's a compatibility breaker and release blocker.

@bb7133
Copy link
Member

bb7133 commented Mar 16, 2022

Thanks for reporting this. It's hard to say that this a bug of TiDB since I found that it is a known bug of go-sql-driver which has been fixed since 1.4.0:

go-sql-driver/mysql#785

However, I agree with @djshow832 with #33142 because:

  • We do not know how many TiDB users are using go-sql-driver 1.3.0 and this issue will break their workloads.
  • The time for code freeze of v6.0 is close and it's hard to dig deeper for a 'fine solution'.

So we can revert the change temporarily and make a careful decision for it after v6.0.

@bb7133 bb7133 added the compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) label Mar 16, 2022
@bb7133
Copy link
Member

bb7133 commented Mar 16, 2022

We will try to think about a 'fine solution' for it.

@VelocityLight VelocityLight added may-affects-5.4 This bug maybe affects 5.4.x versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/critical sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants