var mysql = require('mysql');
var connection = mysql.createConnection(
{
host : 'localhost',
user : 'your-username',
password : 'your-password',
database : 'wordpress',
}
);
connection.connect();
var query = connection.query('SELECT * FROM wp_posts');
query.on('error', function(err) {
throw err;
});
query.on('fields', function(fields) {
console.log(fields);
});
query.on('result', function(row) {
console.log(row.post_title);
});
connection.end();