HLJ 发布于
2018-08-21 16:55:53

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
最后生成于 2023-06-18 18:38:30
此内容有帮助 ?
0