我是一名立志把细节都说清楚的博主,欢迎关注🎉 ~
原创不易,如果有帮助,还请鼓励个【赞】哦~ ❥(^_-)~
报错还原:
Public Key Retrieval is not allowed
背景说明
- MySQL 8.0
- Springboot
报错解决
- 在项目配置文件的url中加上:
allowPublicKeyRetrieval=true
详细演示
- 打开springboot的application.yaml文件。
- springboot默认生成的是application.xml文件,这里只是格式不同而已,意思是一样的,不影响。
- SSM项目在MyBatis里找到url这一项配置,也是一样。
- 在url的最后加上allowPublicKeyRetrieval=true,
- 注意需要用"&"连接。
# Springboot的application.yaml文件。
# DataSource Config
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/vueadmin?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: 123456
我是一名立志把细节都说清楚的博主,欢迎关注🎉 ~
原创不易,如果有帮助,还请鼓励个【赞】哦~ ❥(^_-)~