我已经看到很多答案,但我无法解决我的问题。 我使用节点6.11.2,sails-mysql通过macOS Sierra上的Xampp连接到mysql。 我也试过在protocol.js中增加超时但没有任何作用。
error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: Handshake inactivity timeout
at afterwards (/Users/shubham/VSCode/hirexl/node_modules/sails-mysql/lib/connections/spawn.js:72:13)
at /Users/shubham/VSCode/hirexl/node_modules/sails-mysql/lib/connections/spawn.js:40:7
at Handshake.onConnect (/Users/shubham/VSCode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:54:9)
at Handshake.Sequence.end (/Users/shubham/VSCode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at /Users/shubham/VSCode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:399:18
at Array.forEach (native)
at /Users/shubham/VSCode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:398:13
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
这是我的connections.js代码
module.exports.connections = {
localDiskDb: {
adapter: 'sails-disk'
},
MysqlServer: {
adapter: 'sails-mysql',
host: '127.0.0.1',
database: 'hirexl_test_db',
user: 'root',
password:''
},
MysqlTestServer: {
adapter: 'sails-mysql',
host: '127.0.0.1',
database: 'hirexl_test_db',
user: 'root',
password:''
}
};
有人可以帮忙吗?