// config/databases.js const mysql = require('mysql2/promise'); let pool; const connectDB = async () => { try { pool = await mysql.createPool({ host: process.env.MYSQL_HOST, user: process.env.MYSQL_USER, password: process.env.MYSQL_PASSWORD, database: process.env.MYSQL_DATABASE, <<<<<<< HEAD port: process.env.MYSQL_PORT || 3306, ======= port: process.env.PORT || 3306, >>>>>>> 3d47f2d539024e036b3db88eb1e020180e656065 waitForConnections: true, connectionLimit: 100, queueLimit: 0, }); const [rows] = await pool.query('SELECT 1'); console.log('✅ MySQL Connected'); } catch (error) { console.error(`❌ MySQL Connection Error: ${error.message}`); process.exit(1); } }; const getPool = () => { if (!pool) { throw new Error('MySQL pool not initialized. Call connectDB first.'); } return pool; }; <<<<<<< HEAD module.exports = { connectDB, getPool }; ======= module.exports = { connectDB, getPool }; >>>>>>> 3d47f2d539024e036b3db88eb1e020180e656065