var mysql = require(‘mysql‘);
var client = mysql.createConnection({
host: ‘112.124.54.74‘,
port: 3306,
user: ‘yin‘,
password: ‘691331‘,
database: ‘hu‘
});
client.connect(function(error, results) {
if(error) {
console.log(‘Connection Error: ‘ + error.message);
return;
}
console.log(‘Connected to MySQL‘);
});
client.query(‘SELECT * from hero‘, function(err, rows, fields) {
if (err) throw err;
console.log(‘The solution is: ‘, rows[0].name);
});
client.end();