Error analysis
This error often occurs when I use node to connect to MySQL. I wonder if it is because I do not close the connection every time I query the database after creating a MySQL connection, so the database is always connected and does not respond for a long time, resulting in the following error
error1:
error2:
Solution:
error1:
const mysql = require('mysql');
const connInfo = require('./config');
function queryMysql(sql, callback){
const conn = mysql.createConnection(connInfo)
conn.query(sql, (err, result)=>{
if(err){
console.log(err);
}else {
callback(result)
}
conn.end(err => {
if(err){
console.log(err)
}
})
})
}
module.exports = queryMysql;
Error2:
We only need to configure useConnectionPooling : true when instantiating SessionStore . for example:
var sessionStore = new SessionStore({ host: 'localhost' , port: 3306 , user: 'root' , password: 'root' , database: 'session' , useConnectionPooling: true });
Read More:
- [Solved] Pyodbc.ProgrammingError: No results. Previous SQL was not a query.
- [Solved] Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘event read from binlog did not pass crc check; the first event
- [Solved] Error Code: 2013. Lost connection to MySQL server during query
- [Solved] Worker 1 failed executing transaction ‘ANONYMOUS‘ at master log mall-mysql-bin.000001, end_log_pos
- [Solved] mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this opera
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- [SQL ERROR] SQL Error: could not execute statement & query did not return a unique result: 2; nested excepti
- postgresql-Database query problem-ERROR: column “t.domainid“ must appear in the GROUP BY clause or be used in an a
- ORA-29913 ORA-06512 external table query prompt: error
- [Mybatis] How to Solve the problem of Oracle query processing more than 1000 in conditions
- Solve MySQL table can not query, modify, delete and other operations and appear stuck
- MYSQL reported Fatal error encountered during command execution solution
- Zabbix import MySQL database error ERROR 1046 (3D000) at line 1: No database selected
- MYSQL Slave is not configured or failed to initialize properly. You must at least set –server-id
- ERROR 1265 (01000): Data truncated for column ‘ENABLED’ at row 7
- Solve ERROR 1136 (21S01) in Mysql: Column count doesn’t match value count at row 1
- Mysql Script Error Code: 1136. Column count doesn’t match value count at row 1
- [Solved] sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, “You have an error in your SQ
- [Solved] FATAL ERROR: please install the following Perl modules before executing /application/mysql/scripts/mysql_install_db: Data::Dumper