前端時間在阿里云上安裝MySQL 版本是5.7,安裝完成程序連接數(shù)據(jù)庫一直連不上具體錯誤為:
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原來是5.7版本后連接需要使用SSL安全連接,不過一般數(shù)據(jù)庫都是在內(nèi)網(wǎng)或者在開發(fā)測試環(huán)境下都沒必要使用SSL連接。
解決方法就是在jdbc-url的時候加入ssl
jdbc:mysql://127.0.0.1:3306/apps?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&autoReconnect=true&failOverReadOnly=false&useSSL=true這樣連接查詢數(shù)據(jù)庫的時候會要求使用證書,不過因為我們用了密碼驗證整數(shù)否則獲取不到連接 &verifyServerCertificate=false加上這個參數(shù)可以避免這個問題
新聞熱點
疑難解答
圖片精選