Public Key Retrieval is not allowed解决方法
Public Key Retrieval is not allowed解决方法
项目场景:
问题描述:
原因分析:
解决方案:
Public Key Retrieval is not allowed解决方法
项目场景:
项目搭建初期连接mysql
问题描述:
在appllication.yml中进行数据库配置 启动空项目是,报错 Public Key Retrieval is not allowed
#数据库配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.56.104:3306/company?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false
1
2
3
4
5
6
7
8
原因分析:
查看官网文档的 https:// https://mysqlconnector.net/connection-options/

Name Default Description
AllowPublicKeyRetrieval, Allow Public Key Retrieval false If the user account uses sha256_password authentication, the password must be protected during transmission; TLS is the preferred mechanism for this, but if it is not available then RSA public key encryption will be used. To specify the server’s RSA public key, use the ServerRSAPublicKeyFile connection string setting, or set AllowPublicKeyRetrieval=True to allow the client to automatically request the public key from the server. Note that AllowPublicKeyRetrieval=True could allow a malicious proxy to perform a MITM attack to get the plaintext password, so it is False by default and must be explicitly enabled.
如果用户帐号使用sha256_password认证,则在传输过程中必须对口令进行保护;TLS是实现这一点的首选机制,但如果它不可用,则将使用RSA公钥加密。要指定服务器的RSA公钥,请使用ServerRSAPublicKeyFile连接字符串设置,或将AllowPublicKeyRetrieval=True设置为允许客户端从服务器自动请求公钥。请注意,AllowPublicKeyRetrieval=True可能允许恶意代理执行MITM攻击以获取明文密码,因此它在默认情况下为False,必须显式启用。

解决方案:
修改Druid的url,添加allowPublicKeyRetrieval=true

#数据库配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
url: jdbc:mysql://192.168.56.104:3306/company?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true

(已解决)Public Key Retrieval is not allowed异常的更多相关文章

  1. 关于JDBC连接数据库时出现的Public Key Retrieval is not allowed错误

    问题描述 最近在学习MyBatis框架,参考官方的文档通过配置文件的方式已经实现了通过Configuration配置文件和mapper映射文件访问mysql8数据库,于是想试试不使用XML文件去构建S ...

  2. JDBC链接数据库MySQL 8.0 Public Key Retrieval is not allowed 错误的解决方法

    现象 Mybatis和Spring框架整合过程中报 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Publ ...

  3. Jdbc连接MySQL 8时报错“MySQLNonTransientConnectionException: Public Key Retrieval is not allowed”

    一.问题 因停电检修,今天重启服务器后,再启动jboss就报错"MySQLNonTransientConnectionException: Public Key Retrieval is n ...

  4. MySQL连接提示 public key retrieval is not allowed

    使用DBeaver连接mysql数据提示public key retrieval is not allowed 修改DBeaver的驱动属性中的allowPublicKeyRetrieval

  5. Public Key Retrieval is not allowed

    链接MySQL数据库报错: 数据库连接url中添加对应属性的支持.allowPublicKeyRetrieval=true&useSSL=false url: jdbc:mysql://loc ...

  6. spring boot MySQL Public Key Retrieval is not allowed

    建议在链接url处添加对应的属性 jdbc:mysql://localhost:3306/book?allowPublicKeyRetrieval=true&useSSL=false 

  7. mysql遇到java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

    在连接数据库的url中,加上allowPublicKeyRetrieval=true from:https://blog.csdn.net/Gushiyuta/article/details/9323 ...

  8. Nacos使用 MySQL 8.0 提示Public Key Retrieval is not allowed

    原因如下(参考官网给出的连接选项): 如果用户使用了 sha256_password 认证,密码在传输过程中必须使用 TLS 协议保护,但是如果 RSA 公钥不可用,可以使用服务器提供的公钥:可以在连 ...

  9. Mysql8- Public Key Retrieval is not allowed

    在使用 MySQL 8.0 时重启应用后提示 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public ...

  10. Mysql8.0 Public Key Retrieval is not allow错误的解决办法

    在使用Mysql 8.0时重启后启动项目的事后会报错com.mysql.jdbc.exceptions.jdbc4.MysqlNonTransientConnectionException: Publ ...

随机推荐

  1. 4.2 等差数列及其前n项和

    \(\mathbf{{\large {\color{Red} {欢迎到学科网下载资料学习}} } }\)[[高分突破系列]高二数学下学期同步知识点剖析精品讲义! \(\mathbf{{\large { ...

  2. amfe-flexible 包设置rem的基本值 vue 移动端适配方案

    下载 安装 :npm i -S amfe-flexible gw:GitHub - amfe/lib-flexible: 可伸缩布局方案 下载 2 个第三方包即可实现移动端适配 amfe-flexib ...

  3. kotlin更多语言结构——>异常

    异常类 Kotlin 中所有异常类都是 Throwable 类的子孙类.每个异常都有消息.堆栈回溯信息以及可选的原因 使用 throw-表达式来抛出异常 throw Exception("H ...

  4. 使用svn保存markdown文档

    使用svn管理md文档时,使用谷歌直接访问出现中文乱码,解析格式错误的问题,可以通过安装谷歌浏览器的插件解决. 一.解决格式解析错误的问题 安装插件 Markdown Preview Plus ,安装 ...

  5. Spring 实现 3 种异步流式接口,干掉接口超时烦恼

    大家好,我是小富- 如何处理比较耗时的接口? 这题我熟,直接上异步接口,使用 Callable.WebAsyncTask 和 DeferredResult.CompletableFuture等均可实现 ...

  6. 狂神说-Docker-学习笔记-01 Run的流程和Docker原理

    狂神说-Docker-学习笔记-01 Run的流程和Docker原理 视频链接:https://www.bilibili.com/video/BV1og4y1q7M4?p=1 1.docker run ...

  7. spring boot下跨域安全配置

    1 @Bean 2 public FilterRegistrationBean corsFilter() { 3 final UrlBasedCorsConfigurationSource sourc ...

  8. spring需要在https下进行开发配置方法

    keytool -genkey -alias tomcathttps -keyalg RSA -keysize 2048 -keystore sang.p12 -validity 365 genkey ...

  9. 适合才最美:Shiro安全框架使用心得

    大家好,我是 V 哥.Apache Shiro 是一个强大且灵活的 Java 安全框架,专注于提供认证.授权.会话管理和加密功能.它常用于保护 Java 应用的访问控制,特别是在 Web 应用中.相比 ...

  10. Apache APISIX 和 Kong 的选型对比

    从 API 网关核心功能点来看,两者均已覆盖: 功能 Apache APISIX Kong 动态上游 支持 支持 动态路由 支持 支持 健康检查和熔断器 支持 支持 动态SSL证书 支持 支持 七层和 ...