1、Error: ER_CON_COUNT_ERROR: Too many connections(太多连接池,超出上限)
如何查看连接池,先到mysql的bin目录下面 用管理员终端打开该目录
然后起命令登录**mysql -u root -p**
注意:命令后面要加分号不然不知道你的语句是否结束
查看 连接池限制的语句 show variables like ‘%max_connections%’ 
2、使用node-xlsx 第三方插件将excel表格变为数组,然后继续操作
// 引入 node-xlsx 模块const xlsx = require('node-xlsx');const db = require('./db.js')// excel文件类径const excelFilePath = './data/collegeSummary.xls'//解析excel, 获取到所有sheetsconst sheets = xlsx.parse(excelFilePath);// 查看页面数// console.log(sheets.length);// 打印页面信息..const sheet = sheets[0];const allCollegeData = sheet.data.slice(3)// db.jsconst mysql = require("mysql");const defConfig = {host: "192.168.1.234",user: "zywy",password: "Csqz$%^888",database: "wangke", // 数据库名port: "3306",};console.log('allCollegeData',allCollegeData)const connection = mysql.createConnection(defConfig);connection.connect((err) => {if (err) {console.log("数据库连接失败");throw err;}});let regionIndex = 0;for(let i = 0; i < allCollegeData.length; i ++) {let querySql = '';console.log(`数组长度:${allCollegeData.length},当前索引:${i}, 当前插入项:${allCollegeData[i]}`)if(allCollegeData[i].length === 1){//说明是地区项const currentRegion = allCollegeData[i][0].replace(/\(.*\)/,'');regionIndex = regionIndex + 1querySql = `insert into college_region(region) values('${currentRegion}')`;}else{const item = allCollegeData[i]querySql = `insert into college_summary(college_name, college_code, competent_department, college_region, college_levels, region_id) values('${item[1]}', '${item[2]}', '${item[3]}', '${item[4]}', '${item[5]}', '${regionIndex}')`;}connection.query(querySql);if(i === allCollegeData.length -1 ) {console.log('已经处理完毕!')}}
