mysql 连接池超时

var mysql = require('mysql');
var pool = mysql.createPool({
host: 'localhost',
user: 'nodejs',
password: 'nodejs',
database: 'nodejs',
port: 3306
}); var selectSQL ="show variables like 'wait_timeout'"; pool.getConnection(function (err, conn) {
if (err) console.log("POOL ==> " + err); function query(){
conn.query(selectSQL, function (err, res) {
console.log(new Date());
console.log(res);
conn.release();
});
}
query();
setInterval(query, 5000);
});
上一篇:Java经典设计模式之七大结构型模式(附实例和详解)


下一篇:JavaScript 开发规范