Public Key Retrieval is not allowed
时间: 2023-12-01 21:43:08 浏览: 34
Public Key Retrieval is not allowed是MySQL8.0的一个安全特性,它默认禁止使用不安全的公钥检索方法。如果你使用的是MySQL8.0及以上版本,当你尝试连接到MySQL服务器时,如果你的客户端使用了不安全的公钥检索方法,就会出现这个错误。
解决这个问题的方法是在MySQL连接URL中添加一个参数allowPublicKeyRetrieval=true。这个参数告诉MySQL服务器允许使用不安全的公钥检索方法。以下是一个示例:
```python
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="yourusername",
password="yourpassword",
database="mydatabase",
auth_plugin='mysql_native_password',
url='jdbc:mysql://localhost:3306/mydatabase?allowPublicKeyRetrieval=true'
)
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM customers")
myresult = mycursor.fetchall()
for x in myresult:
print(x)
```
相关问题
public key retrieval is not allowed
Public key retrieval is not allowed是指系统未授权某些用户或应用程序访问公钥,防止数据被未经授权的第三方攻击或篡改,保障系统安全。在密码学中,公钥加密算法一般采用非对称加密算法,即公钥和私钥成对出现,公钥可以公开发布,而私钥必须保密持有。公钥用于加密数据,私钥用于解密数据。如果某些用户或应用程序可以访问公钥,那么它们就有可能窃取私钥,从而窃取数据或者伪造数据,这是不允许的。因此,系统会限制公钥的访问权限,只有经过授权的用户或应用程序才能访问公钥。这种限制可以通过访问控制、加密访问、信任等方式实现。对于使用公钥加密算法的系统,公钥的保护是非常重要的,只有严格控制公钥的使用,才能有效地保障系统安全。
Public Key Retrieval is not allowed Public Key Retrieval is not allowed
回答: "Public Key Retrieval is not allowed"错误通常是由于禁用了SSL/TLS协议传输导致的。在禁用SSL/TLS协议传输后,客户端需要使用服务器的公钥进行传输,但默认情况下客户端不会主动去找服务器拿公钥,从而导致错误的出现。\[2\]解决这个问题的方法有以下几种:一是启用TLS作为首选机制,确保可用;二是设置AllowPublicKeyRetrieval=True,允许客户端自动从服务器请求公钥;三是使用ServerRSAPublicKeyFile连接字符串设置服务器的RSA公钥。需要注意的是,启用AllowPublicKeyRetrieval=True可能会增加恶意代理执行MITM攻击以获取明文密码的风险,因此默认情况下是禁用的,需要显式启用它。\[3\]
#### 引用[.reference_title]
- *1* *2* [Public Key Retrieval is not allowed解决](https://blog.csdn.net/weixin_55599565/article/details/125140094)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [DBeaver连接时报错:Public Key Retrieval is not allowed Public Key Retrieval is not allowed](https://blog.csdn.net/qq_42971035/article/details/120247453)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)