MySQL 8.32 连接错误:'Public Key Retrieval is not allowed' 解决方法
这个错误通常是由于 MySQL 驱动程序使用了旧的身份验证协议而引起的。要解决这个问题,可以在连接 URL 中添加'allowPublicKeyRetrieval=true'参数,它将启用新的身份验证协议。
例如,连接 URL 可能看起来像这样:
jdbc:mysql://localhost:3306/mydatabase?allowPublicKeyRetrieval=true
如果你正在使用 JDBC 驱动程序,你可以在连接代码中添加以下行:
Properties props = new Properties();
props.put('allowPublicKeyRetrieval', 'true');
Connection conn = DriverManager.getConnection(url, props);
这应该解决这个问题。
原文地址: https://www.cveoy.top/t/topic/mkZu 著作权归作者所有。请勿转载和采集!