实例化时配置useConnectionPooling: true
var session = require('express-session');
var mysql = require('mysql');
var MySQLStore = require('express-mysql-session')(session);
var mysqlOption = {
host: 'localhost',
user: 'root',
password: 'root',
database: 'app',
port: 3306,
useConnectionPooling: true,
schema:{
tableName: 'session',
columnNames:{
session_id: 'session_id',
expires: 'expires',
data: 'data'
}
}
};
var sqlconnection = mysql.createConnection(mysqlOption)
var sessionStore = new MySQLStore({},sqlconnection)