优质文章外链发布 5元/条 QQ:2970302840
Camila Waz 发布于
2018-08-21 16:55:53

Node.js链接MySQL数据库

Node.js链接MySQL数据库
var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '',
  database : 'vue'
});
connection.connect();
connection.query('SELECT * from tab1', function(err, rows, fields) {
  if (!err)
    console.log('The solution is: ', rows);
  else
    console.log('Error while performing Query.');
});
connection.end();
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2018-08-21/192.html
最后生成于 2019-11-21 10:18:01