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

Can't connect using mysql client (using password: NO) #14021

Closed
OuSatoru opened this issue Dec 11, 2019 · 6 comments
Closed

Can't connect using mysql client (using password: NO) #14021

OuSatoru opened this issue Dec 11, 2019 · 6 comments
Labels
type/question The issue belongs to a question.

Comments

@OuSatoru
Copy link

OuSatoru commented Dec 11, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    connect using mysql -h x.x.x.x -P 4000 -u root -p mysql -h x.x.x.x -P 4000 -u root -p mypassword mysql -h x.x.x.x -P 4000 -u root -pmypassword

  2. What did you expect to see?
    connect success

  3. What did you see instead?
    Access denied for user 'root'@'xx.xx.xx.xx' (using password: NO)

  4. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    Release Version: v3.0.7
    Git Commit Hash: 84e4386
    Git Branch: HEAD
    UTC Build Time: 2019-12-04 10:08:24
    GoVersion: go version go1.13 linux/amd64
    Race Enabled: false
    TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
    Check Table Before Drop: false

mysql -V
mysql Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)

Can connect when tidb installed without password.
Can't connect after set password with SET PASSWORD FOR 'root'@'%' = 'xxx';
Can connect using database tools like DataGrip.

@OuSatoru OuSatoru added the type/bug The issue is confirmed as a bug. label Dec 11, 2019
@crazycs520
Copy link
Contributor

@OuSatoru which tikv,pd version you used, cann't reproduce this problem in 84e4386 version of tidb-server with mockTiKV.

@OuSatoru
Copy link
Author

@OuSatoru which tikv,pd version you used, cann't reproduce this problem in 84e4386 version of tidb-server with mockTiKV.

I successfully logged in using mysql 5.7 client, while 8.0 client can't log in.

@crazycs520
Copy link
Contributor

@OuSatoru, I can't reproduce this issue with mysql Ver 8.0.18 for Linux on x86_64 too.
which pd, tikv version you used?

@kennytm
Copy link
Contributor

kennytm commented Feb 26, 2020

Reproducible on MySQL 8 client bundled with Ubuntu with master version of TiDB.

The problem is authentication plugin mismatch. While TiDB wants the client to authenticate using mysql_native_password, the client still replies using caching_sha2_password which TiDB doesn't support yet (#9411).

You can force the MySQL client to use the native password plugin with:

mysql --default-auth=mysql_native_password -h ::1 -P 4000 -u user -pPassword ...
#     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@OuSatoru
Copy link
Author

Thank you very much! I didn't see the question! My mysql version was "mysql Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)" on Centos7, successfully connect to tidb with mysql_native_password!

@ghost ghost added type/question The issue belongs to a question. and removed type/bug The issue is confirmed as a bug. labels Jul 21, 2020
@ghost
Copy link

ghost commented Jul 21, 2020

This has also been added to the TiDB FAQ.

With the root cause identified, I am going to go ahead and close this issue. Thanks!

@ghost ghost closed this as completed Jul 21, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question The issue belongs to a question.
Projects
None yet
Development

No branches or pull requests

3 participants