Reputation: 401
I am using sails latest version(0.10.*), I am trying to connect mysql data base, but its throwing following error.
info: Starting app... error: A hook (
orm
) failed to load! error: Error (E_UNKNOWN) :: Encountered an unexpected error : Query inactivity timeout at Query. >(/home/pavan/pavanwork/development/plotstoday/node_modules/sails->mysql/node_modules/mysql/lib/protocol/Protocol.js:154:17) at emitNone (events.js:67:13) at Query.emit (events.js:166:7) at Query._onTimeout >(/home/pavan/pavanwork/development/plotstoday/node_modules/sails->mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:116:8) at Timer.listOnTimeout (timers.js:9
Configuration:
config/connection.js
mysqlServer: {
adapter: 'sails-mysql',
host: 'localhost',
user: 'root',
password: 'vtiger',
database: 'plotstoday'
},
config/model.js
module.exports.models = {
connection: 'mysqlServer',
migrate: 'alter'
};
config/env/development.js
models: {
//connection: 'localMongo'
connection: 'mysqlServer'
}
OS: Ubuntu 14.04 LTS Installed both sails-mysql adapter and node-mysql adapter.
I even tried giving host:127.0.0.1.
Mysql is working fine from command-line, I tried the suggestion given
GRANT ALL PRIVILEGES ON sails.* TO 'homestead'@'%' WITH GRANT OPTION;
(Reference : Sails can not connect to mySql)
Please suggest
Upvotes: 1
Views: 940
Reputation: 401
There is an issue with node(v4.2.0) and mysql. I was using node(v4.2.0), the above issue was coming. I upgraded to node v4.2.1, the above mysql timeout issue is resolved, and everything seems to be working
Upvotes: 1