这个错误通常是因为在MySQL连接字符串中使用了&allowPublicKeyRetrieval=true参数,而MySQL Server版本低于8.0.4。

解决方法:

1.升级MySQL Server到8.0.4或更高版本。

2.在连接字符串中删除&allowPublicKeyRetrieval=true参数。如果您使用的是MySQL Connector/J驱动程序,则可以在URL中添加以下参数:&useSSL=false&allowPublicKeyRetrieval=true

例如:

jdbc:mysql://localhost:3306/mydatabase?useSSL=false&allowPublicKeyRetrieval=true

请注意,删除&allowPublicKeyRetrieval=true参数可能会降低安全性,因为它禁用了使用公钥检索加密密码的功能。如果您需要使用此功能,请升级MySQL Server版本。

连接mysql 报错 Public Key Retrieval is not allowed

原文地址: https://www.cveoy.top/t/topic/0rt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录