这是MySql协议的一个纯 node.js JavaScript客户端实现。
var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'me', password : 'secret', }); connection.connect(); connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) { if (err) throw err; console.log('The solution is: ', rows[0].solution); }); connection.end();
项目主页:http://www.open-open.com/lib/view/home/1377775614854