0
error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: connect ECONNREFUSED 127.0.0.1:3306
at afterwards (/root/sails/sailsUserApp/node_modules/sails-mysql/lib/connections/spawn.js:72:13)
at /root/sails/sailsUserApp/node_modules/sails-mysql/lib/connections/spawn.js:40:7
at Handshake.onConnect [as _callback] (/root/sails/sailsUserApp/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:54:9)
at Handshake.Sequence.end (/root/sails/sailsUserApp/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at Protocol.handleNetworkError (/root/sails/sailsUserApp/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:364:14)
at PoolConnection.Connection._handleNetworkError (/root/sails/sailsUserApp/node_modules/sails-mysql/node_modules/mysql/lib/Connection.js:421:18)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at emitErrorNT (net.js:1280:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
connection.js -獲取錯誤,當我連接mysql帆JS(節點 - V7.5.0)
Mysql:
{
adapter: 'sails-mysql',
host: 'localhost',
port: '3306',
user: 'root', //optional
password: '[email protected]', //optional
database: 'sails_users' //optional
}
models.js - connection: 'Mysql',
我不能找出問題。 端口:3306已在配置中提及。
你在哪裏指定數據庫配置,您可以添加的那部分? –
在connections.js文件 - MySQL的:{ 適配器: '帆-mysql的', 主持人: '本地主機', 端口: '3306', 用戶: '根',//可選 密碼:「SIPL @ 1234',//可選 數據庫:'sails_users'//可選 }, –
您是否能夠使用命令行中的相同證書連接到MySQL 'mysql -u root -psipl @ 1234 sails_users'?請用你的'connections.js'文件的內容更新你的問題。 – Sangharsh