mirror of
https://github.com/danbulant/sql2csv
synced 2026-06-19 14:31:38 +00:00
Create mysql connection
This commit is contained in:
parent
be6e1ad583
commit
4846f4f6f3
1 changed files with 9 additions and 3 deletions
12
index.js
12
index.js
|
|
@ -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
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue