Closed sarthakshah7 closed 5 years ago
Can you try it with the conn.end()
in a .then
after the query?
Like this:
let connection;
...).then(function(conn){
connection = conn;
return conn.query('select * from table_name');
}).then(() => {
connection.end();
})
Thanks @lukeb-uk .
``
I am using promise-mysql version 3.3.1 in a project. I have following the same practices as it was suggested on npm package page. var mysql = require('promise-mysql');
mysql.createConnection({ host: 'localhost', user: 'sauron', password: 'theonetruering', database: 'mordor' }).then(function(conn){ // do stuff with conn let result = conn.query('select * from table_name'); conn.end(); return result; });
But then also connection remains open. when I checked in mysql console using "SHOW FULL PROCESSLIST;" it shows that the connection to db exist with COMMAND : "Sleep" and STATE : ''. I want to close the connection but it is not working as it says. Please let me know for the solution of the same problem.