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