Mysql8- Public Key Retrieval is not allowed
生活随笔
收集整理的這篇文章主要介紹了
Mysql8- Public Key Retrieval is not allowed
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在使用 MySQL 8.0 時重啟應用后提示 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed
最簡單的解決方法是在連接后面添加 allowPublicKeyRetrieval=true
文檔中(https://mysql-net.github.io/MySqlConnector/connection-options/)給出的解釋是:
如果用戶使用了 sha256_password 認證,密碼在傳輸過程中必須使用 TLS 協議保護,但是如果 RSA 公鑰不可用,可以使用服務器提供的公鑰;
可以在連接中通過 ServerRSAPublicKeyFile 指定服務器的 RSA 公鑰,或者AllowPublicKeyRetrieval=True參數以允許客戶端從服務器獲取公鑰;
但是需要注意的是 AllowPublicKeyRetrieval=True可能會導致惡意的代理通過中間人攻擊(MITM)獲取到明文密碼,所以默認是關閉的,必須顯式開啟
總結
以上是生活随笔為你收集整理的Mysql8- Public Key Retrieval is not allowed的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL 5.7安装(linux)
- 下一篇: mybatis-plusspringbo