From 3f4b03dbf57c1f864004aa8591bd583b937462eb Mon Sep 17 00:00:00 2001 From: ywp Date: Thu, 23 Oct 2025 09:45:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20server/config/database.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config/database.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/config/database.js b/server/config/database.js index 27cb7b7..09e17b6 100644 --- a/server/config/database.js +++ b/server/config/database.js @@ -24,15 +24,12 @@ const pool = mysql.createPool({ // 测试数据库连接 async function testConnection() { - try { + const connection = await pool.getConnection(); console.log('数据库连接成功'); connection.release(); - return true; - } catch (error) { - console.error('数据库连接失败:', error.message); - return false; - } + + } // 执行查询