node.js - User Limit Reached when connection is requested in pool of mysql database -
In node js, I have created a pool for database connectivity
var pool = Mysql .createPool (// Use a pool for multiple connections {connection: command: 4, waiter connection: true, qi limit: 0, host: hostname, user: username, password: passName, database: database name}) ;
The code works fine after creating four connections, but five connection requests for connection are in queue after pool and then I
pool_getConnection (funtion (Err) {if (err) console.log ('[error] with connection' + err););); Error occurs then ---> [Error] Error with connection: ER_USER_LIMIT_REACHED: User 'b1312146aa0cc6' has created 'max_user_connections' resource ( Current value: 4)
Try this:
< Code> var mysql = required ('mysql'); Var pool = mysql.createPool ({connectionLimit: 4, waitForConnections: true, queueLimit: 0, host: hostName, user: usernames, passwords: passName, database: databaseName}); Var sql = 'Choose from bag * where id =?'; Var args = [1] pool.query (sql, args, function (err, result) {console.log ('result:', result);}) pool.query (sql, args, function (err, result) { Console.log ('result:', result);}) pool.query (sql, args, function (error, result) {console.log ('result:', result);}) pool.query (sql, args , Function (err, result) {console.log ('result:', result);}) pool.query (sql, args, function (err, result) {console.log ('result:', result);} ) // ...
Comments
Post a Comment