index.js 361 Bytes
const mysql = require('mysql');
const option = require('./db_option');
const 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();