25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(mysql): auto fallback to ssl-mode=disabled on TLS handshake failure
t8y2901976bdacc4
diff --git a/crates/dbx-core/src/db/mysql.rs b/crates/dbx-core/src/db/mysql.rsindex 5946f0436e..8cc5ccb523 100644--- a/crates/dbx-core/src/db/mysql.rs+++ b/crates/dbx-core/src/db/mysql.rs@@ -155,7 +155,7 @@ fn mysql_value_to_json(row: &MySqlRow, idx: usize, type_name: &str) -> serde_jso}pub async fn connect(url: &str) -> Result<MySqlPool, String> {- super::with_connection_timeout("MySQL", async {+ let result = super::with_connection_timeout("MySQL", async {MySqlPoolOptions::new().max_connections(5).acquire_timeout(super::connection_timeout())@@ -164,7 +164,38 @@ pub async fn connect(url: &str) -> Result<MySqlPool, String> {.await.map_err(|e| format!("MySQL connection failed: {e}"))})- .await+ .await;++ if let Err(ref e) = result {+ if e.contains("HandshakeFailure") || e.contains("handshake") {+ if let Some(fallback_url) = ssl_fallback_url(url) {+ log::info!("SSL handshake failed, retrying with ssl-mode=disabled");+ return super::with_connection_timeout("MySQL", async {+ MySqlPoolOptions::new()+ .max_connections(5)+ .acquire_timeout(super::connection_timeout())+ .idle_timeout(Duration::from_secs(300))+ .connect(&fallback_url)+ .await+ .map_err(|e| format!("MySQL connection failed: {e}"))+ })+ .await;+ }+ }+ }++ result+}++fn ssl_fallback_url(url: &str) -> Option<String> {+ if url.contains("ssl-mode=preferred") {+ Some(url.replace("ssl-mode=preferred", "ssl-mode=disabled"))+ } else if !url.contains("ssl-mode=") {+ let sep = if url.contains('?') { "&" } else { "?" };+ Some(format!("{url}{sep}ssl-mode=disabled"))+ } else {+ None+ }}pub async fn connect_bare(url: &str) -> Result<MySqlPool, String> {