连接数据库报Public Key Retrieval is not allowed

项目启动报Public Key Retrieval is not allowed解决方法:

在配置文件中添加allowPublicKeyRetrieval=true

案例:

 datasource:
    url: jdbc:mysql://mysql3:3306/reading?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
    driver-class-name: com.mysql.cj.jdbc.Driver  # mysql8.0以前使用com.mysql.jdbc.Driver
    username: root
    password: root
    platform: mysql
    #通过这句配置将druid连接池引入到我们的配置中,spring会尽可能判断类型是什么,然后根据情况去匹配驱动类。
    type: com.alibaba.druid.pool.DruidDataSource

 

posted on 2022-05-10 18:04  让代码飞  阅读(447)  评论(0编辑  收藏  举报

导航

一款免费在线思维导图工具推荐:https://www.processon.com/i/593e9a29e4b0898669edaf7f?full_name=python