我在用Spring Boot通过JPA连接MySQL,本来MySQL用的是5版本,后来升级到8,于是连接时就遇到Public Key Retrieval is not allowed的提示。
后来在连接字符串后面加了一个参数,allowPublicKeyRetrieval=true,这个问题就解决了。
完整的连接配置如下。
datasource: url: jdbc:mysql://localhost:13306/employeeDB?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true username: root password: 123456 driver-class-name: com.mysql.jdbc.Driver