1. 程式人生 > >MySQL建立SSL連線警告

MySQL建立SSL連線警告

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.626+和5.7.6+的要求,如果沒有設定顯式選項,預設情況下必須建立SSL連線。對於不使用SSL的現有應用程式,ValuyServer證書屬性設定為“false”。您需要通過設定USESL= false來顯式禁用SSL,或者設定USELS=真,併為伺服器證書驗證提供信任儲存。

解決方法:

正如warn中所說的,需要在建立連線時,顯式宣告不驗證SSL, 設定url即可!

String url = "jdbc:mysql://localhost:3306/db_test?verifyServerCertificate=false&useSSL=false"


在連線mysql的url上加上引數:   verifyServerCertificate=false&useSSL=false