I am running a Node JS + Socket.io server which makes a database connection with MySQL Server.
I have written the following code at the global level( i.e. not inside any of the functions )
// All this code is at Global level...
var mysql = require( 'mysql' );
var GDbConnection = mysql.createConnection( {
host : DB_DATA_HOST,
user : DB_DATA_USER,
password : DB_DATA_PASS,
database : DB_DATA_NAME,
insecureAuth : true
});
The connection gets established and I am able to run all kinds of queries.
But the problem is that when I try to find the number of connections made with MySQL Server by running SHOW PROCESSLIST;
command externally, it does not display that database connection.
As far as I know in such a case a persistent database connection is made. Can anybody explain this behavior of NodeJS and MySQL.
Also I inserted a query that takes ~5 mins to execute, while the query was getting executed, I was able to see the database connection using SHOW PROCESSLIST;
Any help on understanding this behavior would be appreciated.