node mysql


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();


node mysql

上一篇:(转)PHP中构造函数和析构函数解析


下一篇:gimagex 2.0.17 汉化版