
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
An easy way to connect to multiple mysql databases in one shot.
To use in your project, just execute
npm install mysql-all --save
This will download mysql-all as well as add it as a dependency to your package.json.
Then require mysql-all in your code:
var mysqlAll = require('mysql-all');
//pass in your connections object and return option
var connections = mysqlAll(connections, option);
For our example usescases, we will use
var arrayConfigs = [
{
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db1'
},
{
host : 'somehost',
user : 'someone',
password : 'secret',
database : 'my_db2'
},
{
host : 'anotherhost',
user : 'you',
password : 'secret',
database : 'my_db2'
},
];
var objectConfigs = {
financedb:{
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db1'
},
hrdb:{
host : 'anotherhost',
user : 'you',
password : 'secret',
database : 'my_db2'
}
};
var connections = require('mysql-all')(arrayConfigs, 'array');
//output connections
[conn1, conn2, conn3]
var connections = require('mysql-all')(arrayConfigs, 'object');
//outputs an object of connections with host+database name as keys:
{
localhostmy_db1: 'connection to localhost',
somehostmy_db2: 'connection to somehost',
anotherhostmy_db2: 'connection to anotherhost'
}
var connections = require('mysql-all')(arrayConfigs);
//outputs an object of connections with host+database name as keys:
{
localhostmy_db1: 'connection to localhost',
somehostmy_db2: 'connection to somehost',
anotherhostmy_db2: 'connection to anotherhost'
}
//NOTE: this yields same result as usecase 2
var connections = require('mysql-all')(objectConfigs, 'array');
//output connections
[conn1, conn2]
//NOTE: this yields similar result as usecase 1
var connections = require('mysql-all')(objectConfigs, 'object');
//output connections
{
financedb: 'connection to finance db',
hrdb: 'connection to hr db'
}
//NOTE: this yields similar result as usecase 3
//except that in this case the keys in the output object will be same as the
// keys in the input connection object/json (objectConfigs) //object/JSON.
//Also not that if 'object' was not specified i.e: require('mysql-all')(objectConfigs);
// output will be same since mysql-all defaults to object when no return option is specified.
Array.
Object literals and
JSON.
FAQs
An easy way to connect to multiple mysql databases
The npm package mysql-all receives a total of 3 weekly downloads. As such, mysql-all popularity was classified as not popular.
We found that mysql-all demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.