I'm trying to understand the difference between
mysql.createConnection
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'example.org',
user : 'bob',
password : 'secret'
});
and
mysql.createPool
var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit : 10,
host : 'example.org',
user : 'bob',
password : 'secret'
});
in the mysql module for Node.js.
I am already familiar with mysql.createConection . Apparently this is the default way to establish a connection to MySQL.
What exactly does mysql.createPool do?
When will I start using mysql.createPool?
What are the benefits of using mysql.createPool rather than mysql.createConnection ?
source
share