I have web app running on NodeJS + MySQL. Initially the web app works fine,but all of a sudden the MySQL connection gets refused with following error being thrown:
ECONNREFUSED 127.0.0.1:3306
Simply restarting the server with pm2 reload solves the issue temporarily.But again after a long span of time,the above error creeps in.
The configuration in NodeJS for making MySQL connection is as following:
"sqlconn": {
"connectionLimit": 10,
"host": "127.0.0.1",
"user": "root",
"password": "XYZ",
"database": "test",
"port": 3306,
"multipleStatements": true
}
Any idea on how to resolve this issue?
NOTE: I am using a digital ocean droplet with RAM size 512MB