■ mysql
node.js 에서 mysql을 사용하고자 하는 경우 아래의 모듈을 활용한다.
- 사이트
https://github.com/felixge/node-mysql- npm을 통한 설치
npm install mysql
- 설명
Introduction
This is a node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.
Here is an example on how to use it:
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();
From this example, you can learn the following:
- Every method you invoke on a connection is queued and executed in sequence.
- Closing the connection is done using end() which makes sure all remaining queries are executed before sending a quit packet to the mysql server.
[SITE]Gravatar(그라바타) (0) | 2015.06.05 |
---|---|
[MySQL]MySQL Community Server 5.6.24(Window) 설정 (2) | 2015.05.09 |
[Node.js]서버 실행 모듈 - forever (0) | 2015.05.08 |
[Node.js]서버 실행 모듈 - supervisor (0) | 2015.05.08 |
[HTML5]스프라이트 이미지 (0) | 2015.05.01 |
댓글 영역