问题描述
一段时间没有用本地数据库,使用dbeaver连接mysql报错:Public Key Retrieval is not allowed
原因分析:
Public Key Retrieval is not allowed:不允许进行公钥检索。
解决方案:
在编辑连接中找到allowPublicKeyRetrieval 设置成TRUE
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
properties allowPublicKeyRetrieval and serverRSAPublicKeyFile)
must be used.
If the MySQL server's default authentication method was SHA256 but neither one of
the Connector/J connection properties allowPublicKeyRetrieval and
serverRSAPublicKeyFile was set, the authentication failed with a
TransientConnectionException, 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)
大致意思是说使用caching_sha2_password插件的,这两个属性必须要设置一个。如果两个都没有设置,会抛public key could not be retrieved异常
如果是jdbc连接,则加上对应参数
jdbcUrl=jdbc:mysql://localhost:3306/coin-vue?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true