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

server: Improve compatibility with MySQL 5.5 and 5.6 clients #32338

Merged
merged 12 commits into from
Mar 3, 2022

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Feb 14, 2022

What problem does this PR solve?

Issue Number: close #32334

Problem Summary:

With a MySQL 5.5 or MySQL 5.6 client connecting to an account in TiDB that uses mysql_native_password,
as authentication plugin but doesn't have a password set results in connection failures.

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Compatibility with MySQL 5.5 and MySQL 5.6 and passwordless accounts was improved.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • mjonss
  • morgo

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 14, 2022
@dveeden dveeden marked this pull request as draft February 14, 2022 14:18
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2022
@dveeden dveeden marked this pull request as ready for review February 14, 2022 14:48
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2022
@dveeden
Copy link
Contributor Author

dveeden commented Feb 14, 2022

/cc @morgo @mjonss @seiya-annie

@dveeden
Copy link
Contributor Author

dveeden commented Feb 14, 2022

/label affects-5.4

@ti-chi-bot ti-chi-bot added the affects-5.4 This bug affects 5.4.x versions. label Feb 14, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Feb 14, 2022

@dveeden
Copy link
Contributor Author

dveeden commented Feb 14, 2022

Without this PR

TiDB Client Test
Connected to:
	Release Version: v5.5.0-alpha-326-g2d9394421
	Edition: Community
	Git Commit Hash: 2d93944210c460dacce66900de21b23c838092fb
	Git Branch: master
	UTC Build Time: 2022-02-14 15:00:40
	GoVersion: go1.16.13
	Race Enabled: false
	TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
	Check Table Before Drop: false
Clients:
	/home/dvaneeden/opt/mysql/5.1.73/bin/mysql
	/home/dvaneeden/opt/mysql/5.5.62/bin/mysql
	/home/dvaneeden/opt/mysql/5.6.44/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.31/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.36/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.22/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.25/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.26/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.27/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.28/bin/mysql
-----------------------------------------------
Test results for test with mysql_native_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅
-----------------------------------------------
❌	  Command '/home/dvaneeden/opt/mysql/5.5.62/bin/mysql -u nopw -h 127.0.0.1 -P 4000 -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.5.62/bin/mysql -u nopw -S /tmp/tidb.sock -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.5.62/bin/mysql -u socket -S /tmp/tidb.sock -pdvaneeden -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.6.44/bin/mysql -u nopw -h 127.0.0.1 -P 4000 -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.6.44/bin/mysql -u nopw -S /tmp/tidb.sock -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.6.44/bin/mysql -u socket -S /tmp/tidb.sock -pdvaneeden -e QUIT' returned 1.
Warning: Using a password on the command line interface can be insecure.
ERROR 2012 (HY000): Error in server handshake

Test results for test with caching_sha2_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	❌	❌	✅	✅	✔️	✔️	✔️	❌
5.6.44  	❌	❌	✅	✅	✔️	✔️	✔️	❌
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅

With this PR

TiDB Client Test
Connected to:
	Release Version: v5.5.0-alpha-328-g416b3ed1e
	Edition: Community
	Git Commit Hash: 416b3ed1ebf5ee70b717f7f6e658d89efd52e08e
	Git Branch: old_nopw_client
	UTC Build Time: 2022-02-14 15:02:08
	GoVersion: go1.16.13
	Race Enabled: false
	TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
	Check Table Before Drop: false
Clients:
	/home/dvaneeden/opt/mysql/5.1.73/bin/mysql
	/home/dvaneeden/opt/mysql/5.5.62/bin/mysql
	/home/dvaneeden/opt/mysql/5.6.44/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.31/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.36/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.22/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.25/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.26/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.27/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.28/bin/mysql
-----------------------------------------------
Test results for test with mysql_native_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅
-----------------------------------------------
❌	  Command '/home/dvaneeden/opt/mysql/5.5.62/bin/mysql -u socket -S /tmp/tidb.sock -pdvaneeden -e QUIT' returned 1.
ERROR 2012 (HY000): Error in server handshake

❌	  Command '/home/dvaneeden/opt/mysql/5.6.44/bin/mysql -u socket -S /tmp/tidb.sock -pdvaneeden -e QUIT' returned 1.
Warning: Using a password on the command line interface can be insecure.
ERROR 2012 (HY000): Error in server handshake

Test results for test with caching_sha2_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	❌
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	❌
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅

(from https://github.com/dveeden/tidb_client_test @ 47064e5426a60ada71436d6462d9a5e924dc7a40 )

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 14, 2022
Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 14, 2022
@ti-chi-bot
Copy link
Member

@seiya-annie: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ngaut ngaut added the status/can-merge Indicates a PR has been approved by a committer. label Feb 15, 2022
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Feb 15, 2022
This is for clients connecting over a UNIX domain socket to a server with `caching_sha2_password` as default auth.

Test from https://github.com/dveeden/tidb_client_test v0.0.1
```
TiDB Client Test
Connected to:
	Release Version: v5.5.0-alpha-374-gc55ff5018
	Edition: Community
	Git Commit Hash: c55ff5018c9027e50cc3d55b863c2e7902d4e848
	Git Branch: old_nopw_client
	UTC Build Time: 2022-02-18 14:39:04
	GoVersion: go1.18rc1
	Race Enabled: false
	TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
	Check Table Before Drop: false
Clients:
	/home/dvaneeden/opt/mysql/5.1.73/bin/mysql
	/home/dvaneeden/opt/mysql/5.5.62/bin/mysql
	/home/dvaneeden/opt/mysql/5.6.44/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.31/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.36/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.22/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.25/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.26/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.27/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.28/bin/mysql
-----------------------------------------------
Test results for test with mysql_native_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅
-----------------------------------------------
Test results for test with caching_sha2_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅
```

I created and used https://github.com/dveeden/sock_debug to troubleshoot
this.
@dveeden
Copy link
Contributor Author

dveeden commented Feb 18, 2022

With my latest commit added:

TiDB Client Test
Connected to:
	Release Version: v5.5.0-alpha-374-gc55ff5018
	Edition: Community
	Git Commit Hash: c55ff5018c9027e50cc3d55b863c2e7902d4e848
	Git Branch: old_nopw_client
	UTC Build Time: 2022-02-18 14:39:04
	GoVersion: go1.18rc1
	Race Enabled: false
	TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
	Check Table Before Drop: false
Clients:
	/home/dvaneeden/opt/mysql/5.1.73/bin/mysql
	/home/dvaneeden/opt/mysql/5.5.62/bin/mysql
	/home/dvaneeden/opt/mysql/5.6.44/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.31/bin/mysql
	/home/dvaneeden/opt/mysql/5.7.36/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.22/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.25/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.26/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.27/bin/mysql
	/home/dvaneeden/opt/mysql/8.0.28/bin/mysql
-----------------------------------------------
Test results for test with mysql_native_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅
-----------------------------------------------
Test results for test with caching_sha2_password as default authentication format
auth    	native	native	native	native	sha2	sha2	socket	socket
user    	nopw	nopw	native	native	sha2	sha2	socket	socket
connection	TCP	socket	TCP	socket	TCP	socket	TCP	socket
5.1.73  	✅	✅	✅	✅	✔️	✔️	✔️	✔️
5.5.62  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.6.44  	✅	✅	✅	✅	✔️	✔️	✔️	✅
5.7.31  	✅	✅	✅	✅	✅	✅	✔️	✅
5.7.36  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.22  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.25  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.26  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.27  	✅	✅	✅	✅	✅	✅	✔️	✅
8.0.28  	✅	✅	✅	✅	✅	✅	✔️	✅

@hawkingrei
Copy link
Member

Have some error in the linter. Please fix it.

@hawkingrei
Copy link
Member

/run-mysql-test

@zimulala
Copy link
Contributor

zimulala commented Mar 3, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 3fa1d02

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. release-note size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using MySQL 5.5 and 5.6 clients connecting with a passwordless account to tidb fail
9 participants