import mysql from 'mysql2/promise'; const pool = mysql.createPool({ host: '127.0.0.1', port: 3306, user: 'root', password: 'semogabisayok321', database: 'mhsdb', waitForConnections: true, connectionLimit: 10, queueLimit: 0 }); // Test the connection const testConnection = async () => { try { const connection = await pool.getConnection(); console.log('Database connection successful'); connection.release(); return true; } catch (error) { console.error('Database connection failed:', error); return false; } }; // Export both the pool and the test function export { pool as default, testConnection };