Skip to content

Conversation

@TomShawn
Copy link
Contributor

@TomShawn TomShawn commented Jul 14, 2020

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

The MySQL command line client (mysql) as well as the libmysqlclient client library have changed their default authentication plugin. See https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password for more information about that change.

It's no longer possible to connect to a TiDB Server using those clients if the user account has a password set, unless the default-auth=mysql_native_password option is used.

This behavior can be seen in this example:

mysql> create user myuser identified by 'password';
Query OK, 0 rows affected (0.05 sec)

$ mysql --version
mysql  Ver 8.0.19 for osx10.15 on x86_64 (Homebrew)

$ mysql -u myuser -ppassword
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'myuser'@'127.0.0.1' (using password: NO)

Note that the error message says "using password: NO", even though a password is given on the command line.

The --default-auth=mysql_native_passwword option allows the connection to succeed:

$ mysql -u myuser -ppassword --default-auth=mysql_native_password -e 'select version()'
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------------------------------------+
| version()                                |
+------------------------------------------+
| 5.7.25-TiDB-v4.0.0-beta.2-443-ge0ec3e3ca |
+------------------------------------------+

This patch makes several updates to pages in the documentation that deal with MySQL compatibility, setting passwords, and connecting to TiDB using MySQL clients.

  • master (the latest development version)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

@TomShawn TomShawn added translation/from-docs This PR is translated from a PR in pingcap/docs. needs-cherry-pick-3.1 labels Jul 14, 2020
@TomShawn TomShawn requested review from jackysp and yikeke July 14, 2020 11:40
@TomShawn TomShawn force-pushed the mysql8.0-auth-note branch from a47a004 to 9c5b6c6 Compare July 14, 2020 11:43
Copy link
Contributor

@yikeke yikeke left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2020
@yikeke yikeke added the require-LGT1 Indicates that the PR requires an LGTM. label Jul 17, 2020
Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com>
@yikeke
Copy link
Contributor

yikeke commented Jul 17, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 17, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 8e5278a into pingcap:master Jul 17, 2020
@TomShawn TomShawn deleted the mysql8.0-auth-note branch July 17, 2020 06:03
ti-srebot pushed a commit to ti-srebot/docs-cn that referenced this pull request Jul 17, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-2.1 in PR #3987

ti-srebot pushed a commit to ti-srebot/docs-cn that referenced this pull request Jul 17, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-3.0 in PR #3988

ti-srebot pushed a commit to ti-srebot/docs-cn that referenced this pull request Jul 17, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-3.1 in PR #3989

ti-srebot pushed a commit to ti-srebot/docs-cn that referenced this pull request Jul 17, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #3990

TomShawn added a commit that referenced this pull request Jul 17, 2020
* cherry pick #3969 to release-3.1

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Update security-compatibility-with-mysql.md

* Update user-account-management.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
TomShawn added a commit that referenced this pull request Jul 17, 2020
* cherry pick #3969 to release-4.0

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Update user-account-management.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
ti-srebot added a commit that referenced this pull request Jul 17, 2020
* cherry pick #3969 to release-2.1

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Update security-compatibility-with-mysql.md

* Update user-account-management.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
ti-srebot added a commit that referenced this pull request Jul 17, 2020
* cherry pick #3969 to release-3.0

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Update security-compatibility-with-mysql.md

* Update user-account-management.md

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

require-LGT1 Indicates that the PR requires an LGTM. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. translation/from-docs This PR is translated from a PR in pingcap/docs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants