gpt4 book ai didi

mysql - 无法将 MySQL 与 Sails js 连接

转载 作者:行者123 更新时间:2023-11-28 23:48:04 26 4
gpt4 key购买 nike

我正在使用 sails 最新版本(0.10.*),我正在尝试连接 mysql 数据库,但它抛出以下错误。

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

配置:

配置/连接.js

  mysqlServer: {
adapter: 'sails-mysql',
host: 'localhost',
user: 'root',
password: 'vtiger',
database: 'plotstoday'
},

配置/模型.js

module.exports.models = {
connection: 'mysqlServer',
migrate: 'alter'

};

配置/env/development.js

models: {
//connection: 'localMongo'
connection: 'mysqlServer'
}

操作系统:Ubuntu 14.04 LTS安装了 sails-mysql 适配器和 node-mysql 适配器。

我什至尝试给主机:127.0.0.1。

Mysql 在命令行下运行良好,我尝试了给出的建议

GRANT ALL PRIVILEGES ON sails.* TO 'homestead'@'%' WITH GRANT OPTION; 

(引用:Sails can not connect to mySql)

请推荐

最佳答案

node(v4.2.0) 和 mysql 有问题。我正在使用 Node (v4.2.0),上面的问题来了。我升级到node v4.2.1,上面的mysql超时问题解决了,一切正常

关于mysql - 无法将 MySQL 与 Sails js 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33187825/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com