node-mysql 在4.2.0的时候遇到的错误
时间:2021-07-01 10:21:17
帮助过:2人阅读
express = require(
"express");
var mysql = require(
"mysql");
var router = express.Router();
router.get(
"/",
function (req, res, next) {
var connection = mysql.createConnection({
host:
"localhost",
user:
"nodejs",
password:
"nodejs",
database:
"nodejs",
port: 3306
});
connection.query(
"select * from employees",
function (err, rows, fields) {
if (err)
throw err;
console.log(rows);
connection.end();
res.send(rows);
});
});
module.exports = router;
node-mysql 在4.2.0的时候遇到的错误
标签: