Error: Public Key Retrieval is not Allowed

Phoenix Rising
Jan 20, 2024

--

A short note if you are using mySQL 8+ and probably hit the “Public Key Retrieval is not Allowed” issue while running some SpringBoot Application using Hibernate . All you need to do especially if you are using useSSL=false in your database url defined in your application.properties file is to set the flag AllowPublicKeyRetrieval to true, like for example:

spring.datasource.url=jdbc:mysql://localhost:3306/music
?characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true <---- here

⚠️ As mentioned in the official documentation, the AllowPublicKeyRetrieval is to be used with caution as setting this to false makes it vulnerable for Man in the middle attacks.

--

--