【发布时间】:2020-04-11 08:14:11
【问题描述】:
我正在将相当多的数据保存到数据库中,但我不断收到此错误
Error: Handshake inactivity timeout
at Handshake.<anonymous> (/project/node_modules/mysql/lib/protocol/Protocol.js:164:17)
code: 'PROTOCOL_SEQUENCE_TIMEOUT',
fatal: true,
timeout: 10000 }
我浏览了帖子,提到的地方很少增加连接限制,但是当我查看 V1sailsjs 关于连接限制时,我看不到太多。我看到类似 3-4 年前的帖子在谈论一个文件 config/connection.js,它甚至不存在。
但我仍然尝试在 config/datastore.js 中添加配置以将池设置为 false。
所以我在
default: {
/***************************************************************************
* *
* Want to use a different database during development? *
* *
* 1. Choose an adapter: *
* https://sailsjs.com/plugins/databases *
* *
* 2. Install it as a dependency of your Sails app. *
* (For example: npm install sails-mysql --save) *
* *
* 3. Then pass it in, along with a connection URL. *
* (See https://sailsjs.com/config/datastores for help.) *
* *
***************************************************************************/
adapter: 'sails-mysql',
url: 'mysql://user:pass@ip:port/db_name',
pool: false,
},
但我仍然得到错误。 有谁知道我应该怎么做?
提前感谢您的帮助。
【问题讨论】:
-
确保您的 MySQL 服务器正在运行,并且您已将 db_name 定义为 MySQL 中的数据库
标签: javascript mysql node.js database sails.js