nodejs操作mysql

demo


1. 安装

$ npm install mysql

2. 代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'root',
database : 'test'
});
connection.connect();
connection.query('select * from test', function(err, rows) {
if (err) throw err;
console.log('The solution is: ', rows);
console.log(fiels);
});
connection.end();

3. 结束

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. 1. 安装
  2. 2. 2. 代码
  3. 3. 3. 结束
,