better solution is to use pool - ill handle this for you.
const pool = mysql.createPool({_x000D_
host: 'localhost',_x000D_
user: '--',_x000D_
database: '---',_x000D_
password: '----'_x000D_
});_x000D_
_x000D_
// ... later_x000D_
pool.query('select 1 + 1', (err, rows) => { /* */ });
_x000D_