MySqlConnector icon indicating copy to clipboard operation
MySqlConnector copied to clipboard

Authentication method 'caching_sha2_password' failed

Open kevinHMS opened this issue 7 months ago • 6 comments
trafficstars

Issue: Unable to connect to the mysql server, errorMsg: Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.

MySQL version: 8.0.40

More network trace information as below:

  1. From the first MySQL protocol packet from client to server: the client Auth Plugin is: mysql_native_password

Image

  1. Then from server end, it sends following response: The server requests the client to use authentication as: caching_sha2_password.

Image

  1. And the client sent a response back and server started to do caching_sha2_password auth.

Image

  1. Then we can see the server responded error

Image

In the older version which is connecting to the same My SQL server, after server sends the perform full authentication packet, we can see client sends the request_public_key request and then got the public key from server end.

Image

Please help to check why the behavior is different.

kevinHMS avatar Mar 28 '25 04:03 kevinHMS