diff --git a/app.js b/app.js
index 11819517c40c00de7bbeb1d899eff63a838bc8fd..fae6bb3cf07a3cc9762945b24fb138eea3043306 100644
--- a/app.js
+++ b/app.js
@@ -1,34 +1,26 @@
 const express = require('express');
-const mysql = require('mysql2/promise');
+const mysql = require('mysql2');
 const session = require('express-session');
 const app = express();
 const port = 3000;
 
 // การตั้งค่าการเชื่อมต่อฐานข้อมูล MySQL (ใช้ pool)
-const db = mysql.createPool({
+const db = mysql.createConnection({
   host: process.env.DB_HOST,
   port: process.env.DB_PORT,
   user: process.env.DB_USER,
   password: process.env.DB_PASSWORD,
-  database: process.env.DB_NAME,
+  database: process.env.DB_NAME, // replace with your database name
   waitForConnections: true,
   connectionLimit: 10,
   queueLimit: 0
 });
 
 // Test the database connection to ensure everything is set up correctly
-async function testConnection() {
-  try {
-      const connection = await db.getConnection();
-      await connection.ping(); // Check connection
-      console.log("Connected to the database.");
-      connection.release();
-  } catch (err) {
-      console.error("Database connection failed:", err);
-      process.exit(1); // Exit if DB connection fails
-  }
-}
-testConnection();
+db.connect(err => {
+  if (err) throw err;
+  console.log("Connected to the database.");
+});
 
 module.exports = { db };