【发布时间】:2019-09-14 11:49:45
【问题描述】:
我最近在实时服务器上部署了我的 node.js API 应用程序。我在实时服务器上遇到了这些问题。
我用谷歌搜索了它,但找不到任何确切的解决方案。谁能建议我如何解决这个问题?
{ Error: read ETIMEDOUT at TCP.onread (net.js:622:25) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'read', fatal: true }
{ Error: Can't add new command when connection is in closed state at PoolConnection._addCommandClosedState }
我是这样使用mysql连接池的
var mysql = require('mysql2');
var mysqlPool = mysql.createPool({
host: 'localhost',
user: 'root',
password: 'xyz',
database: 'xyz',
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
});
module.exports = mysqlPool;
【问题讨论】:
-
我们需要更多代码。你是如何查询数据库的?你的哪一行代码抛出了错误?
-
您是否在
localhost中运行了关于您的Node.js 应用程序所在位置的mysql? -
ETIMEDOUT 通常在服务器未运行或由于防火墙问题(或任何网络可访问性问题)时发生