var connection = mysql.createConnection({
host: config.mysql.host,
port: config.mysql.port,
user: config.mysql.user,
password: config.mysql.pass,
database: config.mysql.db
});
connection.connect(function(error, results) {
if(error) {
console.log('Connection Error: ' + error.message);
return;
}
console.log('Connected to MySQL');
});
connection.end();
connection.connect(); connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) { if (err) throw err; console.log('The solution is: ', rows[0].solution); }); connection.end();
ไม่มีความคิดเห็น:
แสดงความคิดเห็น