index.js
355 Bytes
var mysql = require('mysql');
var option = require('./db_option');
var connection = mysql.createConnection(option);
connection.connect();
connection.query('SELECT * FROM Persons', (err, rows, fields) => {
if (!err) {
console.log('The solution is :', rows);
}
else {
console.error('error: ', err);
}
});
connection.end();