i am facing thi error whenever i make a second call to the api i created using mysql2+expressjs+clearDB(on HERUKO)+heruko deployment server
this is my code ....
const [rows,fields]= await db.execute(MYQUERY,[myarguments])
i am calling the mysql server like this with asyn/await functionality which mysql2 provides
import mysql from 'mysql2/promise'
after that i create the the connection
let db = await mysql.createconnection({
host: 'localhost',
user: "root",
password: "asdzxcasdzxc123123",
database: "doctorapp"
}) export { db }
Any sollution to this error...???
i was facing this error in mysql2/promise
The actual problem is with mysql2/promise .
when you create your connection with mysql database with mysql2 npm package this thing is causing the error...
i solved this error by creating my connection with mysql.creatPool(yourCredentials)
you have to create
in all the contollers ... so it will automatically handles all the required connnection release or other things required to make the connection working perfectly