createConenction, createPool
const mysql = require('mysql');
//createConnection
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
database: 'test'
});
//createPool
const pool = mysql.createPool({
host: 'localhost',
user: 'root',
database: 'test',
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
});
Connection is automatically released when query resolves
reference
https://cotak.tistory.com/105
https://www.npmjs.com/package/mysql2#using-connection-pools