1. 程式人生 > >WARN: Establishing SSL connection

WARN: Establishing SSL connection

disable cte code 應用 acc xxx manager rtt with

在我們使用連接MySQL數據庫時會出現這樣的提示: Tue Aug 29 13:24:29 CST 2017 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. 1 2 3 4 5 6 7 8 翻譯如下: 不推薦服務器身份驗證,不需要建立SSL連接。根據MySQL 5.5.45 +,+,+ 5.6.26 5.7.6要求SSL連接必須建 立明確的選項默認情況下如果不設置。符合現有的應用程序不使用SSL的verifyservercertificate屬性設置 為“false”。你需要顯式禁用SSL設置usessl = false,或設置usessl =真實提供服務器證書驗證信任庫 1 2 3 4 由此可見解決方案如下 在URL加入useSSL=true或者false即可,如下所示: //原先報錯程序 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/scott,"root", "123456"); //更改後正確程序 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/scott?useSSL=false", "root", "123456"); //也可以使用如下 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/scott?useUnicode=true&characterEncoding=utf-8&useSSL=false", "root"

===========================

url 加&useSSL=false

spring.datasource.url=jdbc:mysql://**:3306/xxx.db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false

WARN: Establishing SSL connection