I am looking to create a webserver, with the lightest possible setup. Is it possible to run a webserver with node.js, MySQL on a 512MB RAM server.
问问题
341 次
1 回答
4
你可以打
$ npm 安装 mysql
然后包括
var _mysql = require('mysql');
var HOST = 'localhost';
var PORT = 3306;
var MYSQL_USER = 'nodehacker';
var MYSQL_PASS = 'lulwut';
var DATABASE = 'nodedb';
var TABLE = 'gadgets';
var mysql = _mysql.createClient({
host: HOST,
port: PORT,
user: MYSQL_USER,
password: MYSQL_PASS,
});
mysql.query('use ' + DATABASE);
于 2012-12-18T20:05:58.097 回答