Create mysql connection

This commit is contained in:
danbulant 2019-09-28 15:08:42 +02:00
parent be6e1ad583
commit 4846f4f6f3

View file

@ -1,6 +1,6 @@
const fs = require("fs"); const fs = require("fs");
const sql2csv = require("./sql2csv"); const sql2csv = require("./sql2csv");
const mysql = require("mysql");
const configLoc = "config.yml"; const configLoc = "config.yml";
var config = {}; var config = {};
@ -34,7 +34,8 @@ log();
const s2c = new sql2csv({ const s2c = new sql2csv({
logging: true, logging: true,
skipMysqlCheck: true skipMysqlCheck: true,
colors: true
}); });
log(); log();
@ -76,8 +77,13 @@ if(config.username == undefined){
warn("Undefined username, using root"); warn("Undefined username, using root");
config.username = "root"; config.username = "root";
} }
if(config.password == undefined){ if(config.password == undefined){
warn("Undefined password, using (empty)"); warn("Undefined password, using (empty)");
config.password = ""; config.password = "";
} }
var con = mysql.createConnection({
host: config.host,
user: config.username,
password: config.password
});