解決WARN Establishing SSL connection without servers identity verification is not recommended問題

解決WARN: Establishing SSL connection without server's identity verification is not recommended...問題

一. 異常問題

我在intelliJ idea中進行SSM開發時,在連接mysql數據庫的時候,產生了如下警告信息:

Wed Jun 10 21:42:40 IRKT 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification

警告信息翻譯過來的意思如下:

注意:不建議在沒有服務器身份驗證的情況下建立SSL連接。根據MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果不設置顯式選項,則必須建立默認的SSL連接。您需要通過設置useSSL=false顯式地禁用SSL,或者設置useSSL=true併爲服務器證書驗證提供信任存儲.

 

二. 原因分析

原因是在MySQL 5.5.45+、5.6.26+和5.7.6+等版本中,不建議在沒有服務器身份驗證的情況下建立SSL連接。當然這只是不建議,如果我們非要這麼做,也可以無視該警告信息,這只是一個警告信息,不會影響數據庫的連接和使用。

三.解決辦法

在數據庫連接url後面使用useSSL=false屬性,就可以去除該黃色警告信息了。

jdbc:mysql://localhost:3306/openapi-admin?characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章