我有一个用例,我需要从放置在不同服务器上的两个不同数据库中获取数据(其中一个是我自己的localhost / dev / prod)。关于使用 adapter:'sails-mysql '提供连接的详细信息时,每当我尝试访问数据库(用于简单的select查询)时,都会引发此异常:
debug: err, response -- Error: Could not connect to MySQL:
Error: Handshake inactivity timeout
at afterwards (/Users/xx/code/xx/xx/node_modules/sails-mysql/lib/connections/spawn.js:72:13)
at /Users/xx/code/xx/xx/node_modules/sails-mysql/lib/connections/spawn.js:40:7
at Handshake.onConnect [as _callback] (/Users/xx/code/xx/xx/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:54:9)
at Handshake.Sequence.end (/Users/xx/code/xx/xx/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at /Users/xx/code/xx/xx/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:399:18
at Array.forEach (<anonymous>)
at /Users/xx/code/xx/xx/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:398:13
at process._tickCallback (internal/process/next_tick.js:112:11) undefined
connections.js
的示例:
MySQLServerForDataServer: {
adapter: 'sails-mysql',
host: (process.env.DBNAME_DATA_SERVER_HOST),
user: (process.env.DBNAME_DATA_SERVER_USER),
password: (process.env.DBNAME_DATA_SERVER_PWD),
database: (process.env.DBNAME_DATA_SERVER_DB)
}
我可以通过Valentina Studio或其他服务器(也将ssh密钥添加到那里的服务器)访问该服务器,但是通过代码,这并不能阻止我。
任何人都可以提出一些可以帮助我连接到该DB Server的建议吗?