Idea Springboot project startup error Public Key Retrieval is not allowed

   The project started to report an error. After upgrading mysql, I found that the background error was reported when connecting to mysql. The error reported was the title, and then I checked the information on the Internet.

        If user accounts are authenticated using SHA256_PASSWORD, the password must be protected during transmission; TLS is the preferred mechanism for this, but if it is not available, RSA public key encryption will be used. To specify the server's RSA public key, use the ServerRSPublicKeyFile connection string setting, or set AllowPublicKeyRetrieval=True to allow the client to automatically request the public key from the server. Note that AllowPublicKeyRetrieval=True may allow malicious proxies to perform MITM attacks for plaintext passwords, so it defaults to False and must be explicitly enabled.

        It probably means that the password of the mysql account is encrypted with sha256, and the client does not use the TLS protocol to transmit parameters when connecting to mysql, so the client needs to use the RSA algorithm public key to encrypt the transmission parameters, and the server does not allow the client by default. To obtain the public key, you need to enable this switch.

Solution:

        Added in the driver connection parameters of the client: allowPublicKeyRetrieval=true


 

Guess you like

Origin blog.csdn.net/weixin_39709134/article/details/130552070