mysql 8.0.12 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.

今天玩kafka監控的時候,以前的項目突然跑不起來了,折騰了幾個小時排查清楚。

原因是mysql的SSL默認開啟的,而且mysql8.0.12版本的驅動也和mysql5.2.23左右版本(我以前用的版本)的不一樣。畫

我的排查步驟基本如下:

1.檢查項目引用的mysql版本及本地maven庫相同版本是否存在;

 

 2.檢查數據庫驅動,我現在8.0.12本版本

com.mysql.cj.jdbc.Driver
kafka.eagle.driver=com.mysql.cj.jdbc.Driver
3.查詢SSL的狀態
have_openssl=YES,即SSL是開啟的,有需要的同學可以搜一下如何通過mysql配置文件關閉SSL(因為我沒有關閉成功,所以在這里不展示具體步驟)。
mysql> SHOW VARIABLES LIKE '%ssl%';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| have_openssl  | YES             |
| have_ssl      | YES             |
| ssl_ca        | ca.pem          |
| ssl_capath    |                 |
| ssl_cert      | server-cert.pem |
| ssl_cipher    |                 |
| ssl_crl       |                 |
| ssl_crlpath   |                 |
| ssl_key       | server-key.pem  |
+---------------+-----------------+

4.關閉SSL,在數據庫連接url中要添加關閉SSL的參數userSSL=true
kafka.eagle.url = jdbc:mysql://localhost/ke?userSSL=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT

 參考文章來源:

1. MySQL5.5.45+ 5.6.26+ 5.7.6+關閉SSL驗證:https://blog.csdn.net/boonya/article/details/102565062?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-10&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-10

2.mysql 8.0.18 調用出錯解決辦法:https://blog.csdn.net/qq_40604437/article/details/103715864?depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-3&utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-3


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM