1. 程式人生 > 其它 >MySQL 警告WARN: Establishing SSL connection without server‘s identity verification is not recommended.

MySQL 警告WARN: Establishing SSL connection without server‘s identity verification is not recommended.

技術標籤:mysql

Mon Dec 14 11:33:56 CST 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.

12月14日星期一11:33:56 CST 2020警告:不建議在沒有伺服器身份驗證的情況下建立SSL連線。根據MySQL5.5.45+、5.6.26+和5.7.6+的要求,如果不設定顯式選項,則預設必須建立SSL連線。為了符合不使用SSL的現有應用程式,verifyServerCertificate屬性設定為“false”。您需要通過設定useSSL=false顯式禁用SSL,或者設定useSSL=true並提供用於伺服器證書驗證的信任庫。

解決問題:

 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql01?useUnicode=true&characterEncoding=utf-8&useSSL=false", "root", "root");