mysql 8.0 解决报错Public Key Retrieval is not allowed
项目中数据库mysql从5.7升到8.0后启动报错:java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
经过查找文档,找到两个属性
serverRSAPublicKeyFile
File path to the server RSA public key file for sha256_password authentication. If not specified, the public key will be retrieved from the server.
Since Version 5.1.31 Allows special handshake round-trip to get an RSA public key directly from server.
Default Value false Since Version 5.1.31
serverRSAPublicKeyFile:放置服务器上的公钥文件位置
allowPublicKeyRetrieval:允许从服务器上获取公钥
Note
To authenticate accounts with the
caching_sha2_password
plugin, either a secure connection to the server using SSL or an unencrypted connection that supports password exchange using an RSA key pair (enabled by setting one or both of the connecting propertiesallowPublicKeyRetrieval
andserverRSAPublicKeyFile
) must be used.
大致意思是说使用caching_sha2_password插件的,这两个属性必须要设置一个。
If the MySQL server's default authentication method was SHA256 but neither one of the Connector/J connection properties
allowPublicKeyRetrieval
andserverRSAPublicKeyFile
was set, the authentication failed with aTransientConnectionException
, complaining that the public key could not be retrieved. With this fix, authentication continues in the situation, allowing other enabled authentication methods to be tried. (Bug #20433047, Bug #75670)
如果两个都没有设置,会抛public key could not be retrieved异常。
经过在网上搜索和查文档有两个解决方法:
1. 将allowPublicKeyRetrieval设为true,允许从服务器上获取公钥文件
jdbcUrl=jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
2. 设置公钥文件位置serverRSAPublicKeyFile:
将服务器上数据目录下的public_key.pem拷至本地,连接上加上此属性 serverRSAPublicKeyFile=/data%2Fpublic_key.pem, 文件:/data/public_key.pem, %2F为/,%3A为:
jdbcUrl=jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=GMT%2B8&serverRSAPublicKeyFile=/data%2Fpublic_key.pem
以上两种方法都可以解决。
mysql 8.0 解决报错Public Key Retrieval is not allowed相关推荐
- java mysql的一次报错,Public Key Retrieval is not allowed
文章目录 记录mysql的一次报错,先记录问题,稍后再排查问题所在 Exception 记录mysql的一次报错,先记录问题,稍后再排查问题所在 Exception 2022-09-28 10:58: ...
- MySQL连接报错Public Key Retrieval is not allowed错误
Mysql 8.x版本连接时报错 java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed 可能 ...
- MySQL8报错:Public Key Retrieval is not allowed
前言 连接MySQL数据库的时候,报错内容如下:"Public Key Retrieval is not allowed". 问题分析 mysql 8.0 默认使用 caching ...
- mybatis运行报错java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
mybatis运行报错1 报错:java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed 解决方 ...
- 解决java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
解决java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed 在连接数据库的url中,加上all ...
- 解决mybatis java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
Mybatis报错 Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectio ...
- Public Key Retrieval is not allowed(已解决)
Public Key Retrieval is not allowed(已解决) 在url的连接中加上allowPublicKeyRetrieval=true
- Public Key Retrieval is not allowed解决
记录Public Key Retrieval is not allowed 文章目录 记录Public Key Retrieval is not allowed 一.导致"Public Ke ...
- java.sql.SQLNonTransientConnectionException Public Key Retrieval is not allowed
报错信息 2022-03-18 17:46:43.428 ERROR 20704 - [eate-1849941462] com.alibaba.druid.pool.DruidDataSource ...
最新文章
- 斗争程序猿(三十八)——历史朝代大学(两)——我与数据库的故事
- tcpdump 命令的个常用选项:一
- 【玩转数据】让您的PPT数据图表炫酷起来吧!
- 情人节,你刚表白,而我已经开始选哪里拍婚纱照了~
- BTC引领市场多头情绪爆发 BCH筑底完成望成上涨新风口
- Centos 6.4 搭建LANMP一键安装版
- 编译安装 PHP 扩展 - 含 swoole 扩展安装和升级
- 普及一下equals和==的区别的误区
- python基础===将Flask用于实现Mock-server
- 如何处理SAP CRM错误消息the item category X is not permitted
- ACM 会场安排问题
- 使用Windows Performance Monitor进行SQL Server性能调整
- python中paramiko模块_如何使用python中paramiko模块?
- checking for spandsp >= 3.0... configure: error: no usable spandsp; please install spandsp3 devel pa
- 计算机电池电源转换,整套解决方案:笔记本电脑的外部电源和电池如何实现无缝切换?...
- 【day23】The field file exceeds its maximum permitted size of 1048576 bytes.
- pr cc 2018的快捷键整理
- 智能交通:电子警察系统技术实施方案(ppt)
- 人工智能机器人发展前景,使用/教程/实例
- phpwind 安装教程图文说明