node和数据库建立连接
var express = require('express') , app = express(); var querystring = require('querystring'); var util = require('util'); var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'root', password : '123456', // port: '3306', database: 'test', //数据库名称 }); connection.connect();