mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-30 03:16:12 +03:00
Small fix for using mySQL Database backend. Switch mysql.CreateConnection to mysql.CreatePool.
This commit is contained in:
parent
9d023b8e09
commit
2ab250a10b
4
db.js
4
db.js
@ -665,13 +665,13 @@ module.exports.CreateDB = function (parent, func) {
|
||||
} else if (parent.args.mysql) {
|
||||
// Use MySQL
|
||||
obj.databaseType = 5;
|
||||
var tempDatastore = require('mysql').createConnection(connectionObject);
|
||||
var tempDatastore = require('mysql').createPool(connectionObject);
|
||||
tempDatastore.query('CREATE DATABASE IF NOT EXISTS ' + dbname, function (error) {
|
||||
if (error != null) {
|
||||
console.log('Auto-create database failed: ' + error);
|
||||
}
|
||||
connectionObject.database = dbname;
|
||||
Datastore = require('mysql').createConnection(connectionObject);
|
||||
Datastore = require('mysql').createPool(connectionObject);
|
||||
createTablesIfNotExist(dbname);
|
||||
});
|
||||
setTimeout(function () { tempDatastore.end(); }, 2000);
|
||||
|
Loading…
Reference in New Issue
Block a user