-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_connect.js
44 lines (36 loc) · 1.05 KB
/
db_connect.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// get the client
const mysql = require('mysql');
// create the connection to database
// const connection = mysql.createConnection(
// {
// host: '132.148.203.151',
// user: 'softtruck',
// database: 'softtruck',
// password: 'Qwer-123'
// }
// );
// const connection = mysql.createPool({
// connectionLimit : 10,
// host: '132.148.203.151',
// user: 'softtruck',
// database: 'softtruck',
// password: 'Qwer-123'
// });
const connection = mysql.createPool({
connectionLimit : 10,
host: 'localhost',
user: 'root',
database: 'tb',
password: '316250'
});
module.exports = connection;
// module.exports.mysql = mysql;
// // simple query
// connection.query(
// 'SELECT * FROM `user`',
// function(err, results, fields) {
// if(err) return console.log(err);
// console.log(results); // results contains rows returned by server
// console.log(fields); // fields contains extra meta data about results, if available
// }
// );